index.js000644 0000010520 14652133320007346 0ustar00000000 000000 (()=>{"use strict";var e={998:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=joplin},143:(e,t)=>{var o,n,i,a,l,r,u,c,s,d;Object.defineProperty(t,"__esModule",{value:!0}),t.ContentScriptType=t.SettingStorage=t.AppType=t.SettingItemSubType=t.SettingItemType=t.ToolbarButtonLocation=t.isContextMenuItemLocation=t.MenuItemLocation=t.ModelType=t.ImportModuleOutputFormat=t.FileSystemItem=void 0,(d=t.FileSystemItem||(t.FileSystemItem={})).File="file",d.Directory="directory",(s=t.ImportModuleOutputFormat||(t.ImportModuleOutputFormat={})).Markdown="md",s.Html="html",(c=t.ModelType||(t.ModelType={}))[c.Note=1]="Note",c[c.Folder=2]="Folder",c[c.Setting=3]="Setting",c[c.Resource=4]="Resource",c[c.Tag=5]="Tag",c[c.NoteTag=6]="NoteTag",c[c.Search=7]="Search",c[c.Alarm=8]="Alarm",c[c.MasterKey=9]="MasterKey",c[c.ItemChange=10]="ItemChange",c[c.NoteResource=11]="NoteResource",c[c.ResourceLocalState=12]="ResourceLocalState",c[c.Revision=13]="Revision",c[c.Migration=14]="Migration",c[c.SmartFilter=15]="SmartFilter",c[c.Command=16]="Command",function(e){e.File="file",e.Edit="edit",e.View="view",e.Note="note",e.Tools="tools",e.Help="help",e.Context="context",e.NoteListContextMenu="noteListContextMenu",e.EditorContextMenu="editorContextMenu",e.FolderContextMenu="folderContextMenu",e.TagContextMenu="tagContextMenu"}(o=t.MenuItemLocation||(t.MenuItemLocation={})),t.isContextMenuItemLocation=function(e){return[o.Context,o.NoteListContextMenu,o.EditorContextMenu,o.FolderContextMenu,o.TagContextMenu].includes(e)},(u=t.ToolbarButtonLocation||(t.ToolbarButtonLocation={})).NoteToolbar="noteToolbar",u.EditorToolbar="editorToolbar",(r=t.SettingItemType||(t.SettingItemType={}))[r.Int=1]="Int",r[r.String=2]="String",r[r.Bool=3]="Bool",r[r.Array=4]="Array",r[r.Object=5]="Object",r[r.Button=6]="Button",(l=t.SettingItemSubType||(t.SettingItemSubType={})).FilePathAndArgs="file_path_and_args",l.FilePath="file_path",l.DirectoryPath="directory_path",(a=t.AppType||(t.AppType={})).Desktop="desktop",a.Mobile="mobile",a.Cli="cli",(i=t.SettingStorage||(t.SettingStorage={}))[i.Database=1]="Database",i[i.File=2]="File",(n=t.ContentScriptType||(t.ContentScriptType={})).MarkdownItPlugin="markdownItPlugin",n.CodeMirrorPlugin="codeMirrorPlugin"},156:function(e,t,o){var n=this&&this.__awaiter||function(e,t,o,n){return new(o||(o=Promise))((function(i,a){function l(e){try{u(n.next(e))}catch(e){a(e)}}function r(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(l,r)}u((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=o(998),a=o(143);i.default.plugins.register({onStart:function(){return n(this,void 0,void 0,(function*(){let e,t,o;yield i.default.settings.registerSection("delayedSyncSettings",{label:"Delayed Sync",iconName:"fas fa-clock"}),yield i.default.settings.registerSettings({"delayedSyncSettings.delay":{value:5e3,type:a.SettingItemType.Int,minimum:1e3,section:"delayedSyncSettings",public:!0,label:"Sync Delay",description:"How many milliseconds to wait after a note is changed before triggering a sync."},"delayedSyncSettings.queue":{value:!0,type:a.SettingItemType.Bool,section:"delayedSyncSettings",public:!0,label:"Queue Syncs",description:"Whether to queue a sync if a sync is already in progress and a note is edited. Queue will trigger after Sync Delay."}}),yield i.default.workspace.onSyncStart((()=>{t=!0,console.log("[DelayedSync] isSyncing = true")})),yield i.default.workspace.onSyncComplete((()=>n(this,void 0,void 0,(function*(){t=!1,console.log("[DelayedSync] isSyncing = false"),o&&(o=!1,console.log("[DelayedSync] setting new delay from queue"),yield l())}))));const l=()=>n(this,void 0,void 0,(function*(){const a=yield i.default.settings.value("delayedSyncSettings.delay"),l=yield i.default.settings.value("delayedSyncSettings.queue");console.log(`[DelayedSync] setting delayed sync with delay ${a}, queue ${l}`),t?l&&(o=!0,console.log("[DelayedSync] queueing another sync after this one")):(clearTimeout(e),e=setTimeout((()=>n(this,void 0,void 0,(function*(){console.log("[DelayedSync] running synchronize"),yield i.default.commands.execute("synchronize",!0)}))),a))}));yield i.default.workspace.onNoteChange(l)}))}})}},t={};!function o(n){var i=t[n];if(void 0!==i)return i.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,o),a.exports}(156)})();manifest.json000644 0000000675 14652133320010414 0ustar00000000 000000 { "manifest_version": 1, "id": "joplin-delayed-sync", "app_min_version": "2.13", "version": "1.0.0", "name": "Joplin Delayed Sync", "description": "Add an option to trigger the synchronization after editing a note.", "author": "Luca Zambarda", "homepage_url": "github.com/lzambarda/joplin-delayed-sync", "repository_url": "github.com/lzambarda/joplin-delayed-sync", "keywords": [], "categories": [], "screenshots": [], "icons": {} }