2
0

autosave.js 395 B

1234567891011121314151617181920212223
  1. let plugin = plugin_create();
  2. let h1 = zui_handle_create();
  3. let h2 = zui_handle_create({value: 5});
  4. let timer = 0.0;
  5. plugin.draw_ui = function(ui) {
  6. if (zui_panel(h1, "Auto Save")) {
  7. zui_slider(h2, "min", 1, 15, false, 1);
  8. }
  9. }
  10. plugin.update = function() {
  11. if (project_filepath == "") {
  12. return;
  13. }
  14. timer += 1 / 60;
  15. if (timer >= h2.value * 60) {
  16. timer = 0.0;
  17. project_save();
  18. }
  19. }