os_javascript.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. /*************************************************************************/
  2. /* os_javascript.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #include "os_javascript.h"
  30. #include "drivers/gles2/rasterizer_gles2.h"
  31. #include "core/io/file_access_buffered_fa.h"
  32. #include "drivers/unix/file_access_unix.h"
  33. #include "drivers/unix/dir_access_unix.h"
  34. #include "servers/visual/visual_server_raster.h"
  35. #include "main/main.h"
  36. #include "core/globals.h"
  37. #include "emscripten.h"
  38. int OS_JavaScript::get_video_driver_count() const {
  39. return 1;
  40. }
  41. const char * OS_JavaScript::get_video_driver_name(int p_driver) const {
  42. return "GLES2";
  43. }
  44. OS::VideoMode OS_JavaScript::get_default_video_mode() const {
  45. return OS::VideoMode();
  46. }
  47. int OS_JavaScript::get_audio_driver_count() const {
  48. return 1;
  49. }
  50. const char * OS_JavaScript::get_audio_driver_name(int p_driver) const {
  51. return "JavaScript";
  52. }
  53. void OS_JavaScript::initialize_core() {
  54. OS_Unix::initialize_core();
  55. FileAccess::make_default<FileAccessBufferedFA<FileAccessUnix> >(FileAccess::ACCESS_RESOURCES);
  56. }
  57. void OS_JavaScript::set_opengl_extensions(const char* p_gl_extensions) {
  58. ERR_FAIL_COND(!p_gl_extensions);
  59. gl_extensions=p_gl_extensions;
  60. }
  61. static EM_BOOL joy_callback_func(int p_type, const EmscriptenGamepadEvent *p_event, void *p_user) {
  62. OS_JavaScript *os = (OS_JavaScript*) OS::get_singleton();
  63. if (os) {
  64. return os->joy_connection_changed(p_type, p_event);
  65. }
  66. return false;
  67. }
  68. void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) {
  69. print_line("Init OS");
  70. if (gfx_init_func)
  71. gfx_init_func(gfx_init_ud,use_gl2,p_desired.width,p_desired.height,p_desired.fullscreen);
  72. default_videomode=p_desired;
  73. print_line("Init Audio");
  74. AudioDriverManagerSW::add_driver(&audio_driver_javascript);
  75. if (true) {
  76. RasterizerGLES2 *rasterizer_gles22=memnew( RasterizerGLES2(false,false,false,false) );;
  77. rasterizer_gles22->set_use_framebuffers(false); //not supported by emscripten
  78. if (gl_extensions)
  79. rasterizer_gles22->set_extensions(gl_extensions);
  80. rasterizer = rasterizer_gles22;
  81. } else {
  82. // rasterizer = memnew( RasterizerGLES1(true, false) );
  83. }
  84. print_line("Init VS");
  85. visual_server = memnew( VisualServerRaster(rasterizer) );
  86. visual_server->init();
  87. visual_server->cursor_set_visible(false, 0);
  88. /*AudioDriverManagerSW::get_driver(p_audio_driver)->set_singleton();
  89. if (AudioDriverManagerSW::get_driver(p_audio_driver)->init()!=OK) {
  90. ERR_PRINT("Initializing audio failed.");
  91. }*/
  92. print_line("Init SM");
  93. //sample_manager = memnew( SampleManagerMallocSW );
  94. audio_server = memnew( AudioServerJavascript );
  95. print_line("Init Mixer");
  96. //audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
  97. audio_server->init();
  98. print_line("Init SoundServer");
  99. spatial_sound_server = memnew( SpatialSoundServerSW );
  100. spatial_sound_server->init();
  101. print_line("Init SpatialSoundServer");
  102. spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
  103. spatial_sound_2d_server->init();
  104. //
  105. print_line("Init Physicsserver");
  106. physics_server = memnew( PhysicsServerSW );
  107. physics_server->init();
  108. physics_2d_server = memnew( Physics2DServerSW );
  109. physics_2d_server->init();
  110. input = memnew( InputDefault );
  111. emscripten_set_gamepadconnected_callback(NULL, true, &joy_callback_func);
  112. emscripten_set_gamepaddisconnected_callback(NULL, true, &joy_callback_func);
  113. }
  114. void OS_JavaScript::set_main_loop( MainLoop * p_main_loop ) {
  115. main_loop=p_main_loop;
  116. input->set_main_loop(p_main_loop);
  117. }
  118. void OS_JavaScript::delete_main_loop() {
  119. memdelete( main_loop );
  120. }
  121. void OS_JavaScript::finalize() {
  122. memdelete(input);
  123. }
  124. void OS_JavaScript::vprint(const char* p_format, va_list p_list, bool p_stderr) {
  125. if (p_stderr) {
  126. vfprintf(stderr,p_format,p_list);
  127. fflush(stderr);
  128. } else {
  129. vprintf(p_format,p_list);
  130. fflush(stdout);
  131. }
  132. }
  133. void OS_JavaScript::print(const char *p_format, ... ) {
  134. va_list argp;
  135. va_start(argp, p_format);
  136. vprintf(p_format, argp );
  137. va_end(argp);
  138. }
  139. void OS_JavaScript::alert(const String& p_alert) {
  140. print("ALERT: %s\n",p_alert.utf8().get_data());
  141. }
  142. void OS_JavaScript::set_mouse_show(bool p_show) {
  143. //javascript has no mouse...
  144. }
  145. void OS_JavaScript::set_mouse_grab(bool p_grab) {
  146. //it really has no mouse...!
  147. }
  148. bool OS_JavaScript::is_mouse_grab_enabled() const {
  149. //*sigh* technology has evolved so much since i was a kid..
  150. return false;
  151. }
  152. Point2 OS_JavaScript::get_mouse_pos() const {
  153. return Point2();
  154. }
  155. int OS_JavaScript::get_mouse_button_state() const {
  156. return 0;
  157. }
  158. void OS_JavaScript::set_window_title(const String& p_title) {
  159. }
  160. //interesting byt not yet
  161. //void set_clipboard(const String& p_text);
  162. //String get_clipboard() const;
  163. void OS_JavaScript::set_video_mode(const VideoMode& p_video_mode,int p_screen) {
  164. }
  165. OS::VideoMode OS_JavaScript::get_video_mode(int p_screen) const {
  166. return default_videomode;
  167. }
  168. Size2 OS_JavaScript::get_window_size() const {
  169. return Vector2(default_videomode.width,default_videomode.height);
  170. }
  171. void OS_JavaScript::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const {
  172. p_list->push_back(default_videomode);
  173. }
  174. String OS_JavaScript::get_name() {
  175. return "HTML5";
  176. }
  177. MainLoop *OS_JavaScript::get_main_loop() const {
  178. return main_loop;
  179. }
  180. bool OS_JavaScript::can_draw() const {
  181. return true; //always?
  182. }
  183. void OS_JavaScript::set_cursor_shape(CursorShape p_shape) {
  184. //javascript really really really has no mouse.. how amazing..
  185. }
  186. void OS_JavaScript::main_loop_begin() {
  187. if (main_loop)
  188. main_loop->init();
  189. }
  190. bool OS_JavaScript::main_loop_iterate() {
  191. if (!main_loop)
  192. return false;
  193. if (time_to_save_sync>=0) {
  194. int64_t newtime = get_ticks_msec();
  195. int64_t elapsed = newtime - last_sync_time;
  196. last_sync_time=newtime;
  197. time_to_save_sync-=elapsed;
  198. print_line("elapsed "+itos(elapsed)+" tts "+itos(time_to_save_sync));
  199. if (time_to_save_sync<0) {
  200. //time to sync, for real
  201. // run 'success'
  202. print_line("DOING SYNCH!");
  203. EM_ASM(
  204. FS.syncfs(function (err) {
  205. assert(!err);
  206. console.log("Synched!");
  207. //ccall('success', 'v');
  208. });
  209. );
  210. }
  211. }
  212. process_joysticks();
  213. return Main::iteration();
  214. }
  215. void OS_JavaScript::main_loop_end() {
  216. if (main_loop)
  217. main_loop->finish();
  218. }
  219. void OS_JavaScript::main_loop_focusout() {
  220. if (main_loop)
  221. main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
  222. //audio_driver_javascript.set_pause(true);
  223. }
  224. void OS_JavaScript::main_loop_focusin(){
  225. if (main_loop)
  226. main_loop->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
  227. //audio_driver_javascript.set_pause(false);
  228. }
  229. void OS_JavaScript::push_input(const InputEvent& p_ev) {
  230. InputEvent ev = p_ev;
  231. ev.ID=last_id++;
  232. input->parse_input_event(p_ev);
  233. }
  234. void OS_JavaScript::process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points) {
  235. // print_line("ev: "+itos(p_what)+" pnt: "+itos(p_pointer)+" pointc: "+itos(p_points.size()));
  236. switch(p_what) {
  237. case 0: { //gesture begin
  238. if (touch.size()) {
  239. //end all if exist
  240. InputEvent ev;
  241. ev.type=InputEvent::MOUSE_BUTTON;
  242. ev.ID=last_id++;
  243. ev.mouse_button.button_index=BUTTON_LEFT;
  244. ev.mouse_button.button_mask=BUTTON_MASK_LEFT;
  245. ev.mouse_button.pressed=false;
  246. ev.mouse_button.x=touch[0].pos.x;
  247. ev.mouse_button.y=touch[0].pos.y;
  248. ev.mouse_button.global_x=touch[0].pos.x;
  249. ev.mouse_button.global_y=touch[0].pos.y;
  250. input->parse_input_event(ev);
  251. for(int i=0;i<touch.size();i++) {
  252. InputEvent ev;
  253. ev.type=InputEvent::SCREEN_TOUCH;
  254. ev.ID=last_id++;
  255. ev.screen_touch.index=touch[i].id;
  256. ev.screen_touch.pressed=false;
  257. ev.screen_touch.x=touch[i].pos.x;
  258. ev.screen_touch.y=touch[i].pos.y;
  259. input->parse_input_event(ev);
  260. }
  261. }
  262. touch.resize(p_points.size());
  263. for(int i=0;i<p_points.size();i++) {
  264. touch[i].id=p_points[i].id;
  265. touch[i].pos=p_points[i].pos;
  266. }
  267. {
  268. //send mouse
  269. InputEvent ev;
  270. ev.type=InputEvent::MOUSE_BUTTON;
  271. ev.ID=last_id++;
  272. ev.mouse_button.button_index=BUTTON_LEFT;
  273. ev.mouse_button.button_mask=BUTTON_MASK_LEFT;
  274. ev.mouse_button.pressed=true;
  275. ev.mouse_button.x=touch[0].pos.x;
  276. ev.mouse_button.y=touch[0].pos.y;
  277. ev.mouse_button.global_x=touch[0].pos.x;
  278. ev.mouse_button.global_y=touch[0].pos.y;
  279. last_mouse=touch[0].pos;
  280. input->parse_input_event(ev);
  281. }
  282. //send touch
  283. for(int i=0;i<touch.size();i++) {
  284. InputEvent ev;
  285. ev.type=InputEvent::SCREEN_TOUCH;
  286. ev.ID=last_id++;
  287. ev.screen_touch.index=touch[i].id;
  288. ev.screen_touch.pressed=true;
  289. ev.screen_touch.x=touch[i].pos.x;
  290. ev.screen_touch.y=touch[i].pos.y;
  291. input->parse_input_event(ev);
  292. }
  293. } break;
  294. case 1: { //motion
  295. if (p_points.size()) {
  296. //send mouse, should look for point 0?
  297. InputEvent ev;
  298. ev.type=InputEvent::MOUSE_MOTION;
  299. ev.ID=last_id++;
  300. ev.mouse_motion.button_mask=BUTTON_MASK_LEFT;
  301. ev.mouse_motion.x=p_points[0].pos.x;
  302. ev.mouse_motion.y=p_points[0].pos.y;
  303. input->set_mouse_pos(Point2(ev.mouse_motion.x,ev.mouse_motion.y));
  304. ev.mouse_motion.speed_x=input->get_mouse_speed().x;
  305. ev.mouse_motion.speed_y=input->get_mouse_speed().y;
  306. ev.mouse_motion.relative_x=p_points[0].pos.x-last_mouse.x;
  307. ev.mouse_motion.relative_y=p_points[0].pos.y-last_mouse.y;
  308. last_mouse=p_points[0].pos;
  309. input->parse_input_event(ev);
  310. }
  311. ERR_FAIL_COND(touch.size()!=p_points.size());
  312. for(int i=0;i<touch.size();i++) {
  313. int idx=-1;
  314. for(int j=0;j<p_points.size();j++) {
  315. if (touch[i].id==p_points[j].id) {
  316. idx=j;
  317. break;
  318. }
  319. }
  320. ERR_CONTINUE(idx==-1);
  321. if (touch[i].pos==p_points[idx].pos)
  322. continue; //no move unncesearily
  323. InputEvent ev;
  324. ev.type=InputEvent::SCREEN_DRAG;
  325. ev.ID=last_id++;
  326. ev.screen_drag.index=touch[i].id;
  327. ev.screen_drag.x=p_points[idx].pos.x;
  328. ev.screen_drag.y=p_points[idx].pos.y;
  329. ev.screen_drag.relative_x=p_points[idx].pos.x - touch[i].pos.x;
  330. ev.screen_drag.relative_y=p_points[idx].pos.y - touch[i].pos.y;
  331. input->parse_input_event(ev);
  332. touch[i].pos=p_points[idx].pos;
  333. }
  334. } break;
  335. case 2: { //release
  336. if (touch.size()) {
  337. //end all if exist
  338. InputEvent ev;
  339. ev.type=InputEvent::MOUSE_BUTTON;
  340. ev.ID=last_id++;
  341. ev.mouse_button.button_index=BUTTON_LEFT;
  342. ev.mouse_button.button_mask=BUTTON_MASK_LEFT;
  343. ev.mouse_button.pressed=false;
  344. ev.mouse_button.x=touch[0].pos.x;
  345. ev.mouse_button.y=touch[0].pos.y;
  346. ev.mouse_button.global_x=touch[0].pos.x;
  347. ev.mouse_button.global_y=touch[0].pos.y;
  348. input->parse_input_event(ev);
  349. for(int i=0;i<touch.size();i++) {
  350. InputEvent ev;
  351. ev.type=InputEvent::SCREEN_TOUCH;
  352. ev.ID=last_id++;
  353. ev.screen_touch.index=touch[i].id;
  354. ev.screen_touch.pressed=false;
  355. ev.screen_touch.x=touch[i].pos.x;
  356. ev.screen_touch.y=touch[i].pos.y;
  357. input->parse_input_event(ev);
  358. }
  359. touch.clear();
  360. }
  361. } break;
  362. case 3: { // add tuchi
  363. ERR_FAIL_INDEX(p_pointer,p_points.size());
  364. TouchPos tp=p_points[p_pointer];
  365. touch.push_back(tp);
  366. InputEvent ev;
  367. ev.type=InputEvent::SCREEN_TOUCH;
  368. ev.ID=last_id++;
  369. ev.screen_touch.index=tp.id;
  370. ev.screen_touch.pressed=true;
  371. ev.screen_touch.x=tp.pos.x;
  372. ev.screen_touch.y=tp.pos.y;
  373. input->parse_input_event(ev);
  374. } break;
  375. case 4: {
  376. for(int i=0;i<touch.size();i++) {
  377. if (touch[i].id==p_pointer) {
  378. InputEvent ev;
  379. ev.type=InputEvent::SCREEN_TOUCH;
  380. ev.ID=last_id++;
  381. ev.screen_touch.index=touch[i].id;
  382. ev.screen_touch.pressed=false;
  383. ev.screen_touch.x=touch[i].pos.x;
  384. ev.screen_touch.y=touch[i].pos.y;
  385. input->parse_input_event(ev);
  386. touch.remove(i);
  387. i--;
  388. }
  389. }
  390. } break;
  391. }
  392. }
  393. void OS_JavaScript::process_accelerometer(const Vector3& p_accelerometer) {
  394. input->set_accelerometer(p_accelerometer);
  395. }
  396. bool OS_JavaScript::has_touchscreen_ui_hint() const {
  397. return false; //???
  398. }
  399. void OS_JavaScript::main_loop_request_quit() {
  400. if (main_loop)
  401. main_loop->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
  402. }
  403. void OS_JavaScript::set_display_size(Size2 p_size) {
  404. default_videomode.width=p_size.x;
  405. default_videomode.height=p_size.y;
  406. }
  407. void OS_JavaScript::reload_gfx() {
  408. if (gfx_init_func)
  409. gfx_init_func(gfx_init_ud,use_gl2,default_videomode.width,default_videomode.height,default_videomode.fullscreen);
  410. if (rasterizer)
  411. rasterizer->reload_vram();
  412. }
  413. Error OS_JavaScript::shell_open(String p_uri) {
  414. if (open_uri_func)
  415. return open_uri_func(p_uri)?ERR_CANT_OPEN:OK;
  416. return ERR_UNAVAILABLE;
  417. };
  418. String OS_JavaScript::get_resource_dir() const {
  419. return "/"; //javascript has it's own filesystem for resources inside the APK
  420. }
  421. String OS_JavaScript::get_locale() const {
  422. if (get_locale_func)
  423. return get_locale_func();
  424. return OS_Unix::get_locale();
  425. }
  426. String OS_JavaScript::get_data_dir() const {
  427. //if (get_data_dir_func)
  428. // return get_data_dir_func();
  429. return "/userfs";
  430. //return Globals::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
  431. };
  432. void OS_JavaScript::_close_notification_funcs(const String& p_file,int p_flags) {
  433. print_line("close "+p_file+" flags "+itos(p_flags));
  434. if (p_file.begins_with("/userfs") && p_flags&FileAccess::WRITE) {
  435. static_cast<OS_JavaScript*>(get_singleton())->last_sync_time=OS::get_singleton()->get_ticks_msec();
  436. static_cast<OS_JavaScript*>(get_singleton())->time_to_save_sync=5000; //five seconds since last save
  437. }
  438. }
  439. void OS_JavaScript::process_joysticks() {
  440. int joy_count = emscripten_get_num_gamepads();
  441. for (int i = 0; i < joy_count; i++) {
  442. EmscriptenGamepadEvent state;
  443. emscripten_get_gamepad_status(i, &state);
  444. if (state.connected) {
  445. int num_buttons = MIN(state.numButtons, 18);
  446. int num_axes = MIN(state.numAxes, 8);
  447. for (int j = 0; j < num_buttons; j++) {
  448. float value = state.analogButton[j];
  449. if (String(state.mapping) == "standard" && (j == 6 || j == 7)) {
  450. InputDefault::JoyAxis jx;
  451. jx.min = 0;
  452. jx.value = value;
  453. last_id = input->joy_axis(last_id, i, j, jx);
  454. }
  455. else {
  456. last_id = input->joy_button(last_id, i, j, value);
  457. }
  458. }
  459. for (int j = 0; j < num_axes; j++) {
  460. InputDefault::JoyAxis jx;
  461. jx.min = -1;
  462. jx.value = state.axis[j];
  463. last_id = input->joy_axis(last_id, i, j, jx);
  464. }
  465. }
  466. }
  467. }
  468. bool OS_JavaScript::joy_connection_changed(int p_type, const EmscriptenGamepadEvent *p_event) {
  469. if (p_type == EMSCRIPTEN_EVENT_GAMEPADCONNECTED) {
  470. String guid = "";
  471. if (String(p_event->mapping) == "standard")
  472. guid = "Default HTML5 Gamepad";
  473. input->joy_connection_changed(p_event->index, true, String(p_event->id), guid);
  474. }
  475. else {
  476. input->joy_connection_changed(p_event->index, false, "");
  477. }
  478. return true;
  479. }
  480. bool OS_JavaScript::is_joy_known(int p_device) {
  481. return input->is_joy_mapped(p_device);
  482. }
  483. String OS_JavaScript::get_joy_guid(int p_device) const {
  484. return input->get_joy_guid_remapped(p_device);
  485. }
  486. OS_JavaScript::OS_JavaScript(GFXInitFunc p_gfx_init_func,void*p_gfx_init_ud, OpenURIFunc p_open_uri_func, GetDataDirFunc p_get_data_dir_func,GetLocaleFunc p_get_locale_func) {
  487. default_videomode.width=800;
  488. default_videomode.height=600;
  489. default_videomode.fullscreen=true;
  490. default_videomode.resizable=false;
  491. gfx_init_func=p_gfx_init_func;
  492. gfx_init_ud=p_gfx_init_ud;
  493. main_loop=NULL;
  494. last_id=1;
  495. gl_extensions=NULL;
  496. rasterizer=NULL;
  497. open_uri_func=p_open_uri_func;
  498. get_data_dir_func=p_get_data_dir_func;
  499. get_locale_func=p_get_locale_func;
  500. FileAccessUnix::close_notification_func=_close_notification_funcs;
  501. time_to_save_sync=-1;
  502. }
  503. OS_JavaScript::~OS_JavaScript() {
  504. }