-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 1.47 KB
/
index.js
1
(function(){"use strict";function d(a,e,i,m,o,r,l,C){var t=typeof a=="function"?a.options:a;e&&(t.render=e,t.staticRenderFns=i,t._compiled=!0),m&&(t.functional=!0),r&&(t._scopeId="data-v-"+r);var s;if(l?(s=function(n){n=n||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!n&&typeof __VUE_SSR_CONTEXT__<"u"&&(n=__VUE_SSR_CONTEXT__),o&&o.call(this,n),n&&n._registeredComponents&&n._registeredComponents.add(l)},t._ssrRegister=s):o&&(s=C?function(){o.call(this,(t.functional?this.parent:this).$root.$options.shadowRoot)}:o),s)if(t.functional){t._injectStyles=s;var $=t.render;t.render=function(g,_){return s.call(_),$(g,_)}}else{var f=t.beforeCreate;t.beforeCreate=f?[].concat(f,s):[s]}return{exports:a,options:t}}const v={props:{interval:{default:5e3},label:{default:"Autosave"},saved:{default:"Not yet saved."}},mounted:function(){this.timer=setInterval(async()=>{if(this.$store.getters["content/hasChanges"]()){const e=new Date().toLocaleString();await this.$store.dispatch("content/save"),this.$events.emit("model.update"),this.$panel.notification.success(),this.saved=`Saved: ${e}`}},this.interval)},beforeDestroy(){clearInterval(this.timer)}};var u=function(){var e=this,i=e._self._c;return i("div",[i("span",{staticClass:"k-field-header k-label"},[e._v(e._s(e.label)+" ("+e._s(e.interval)+"ms)")]),i("p",[e._v(e._s(e.saved))])])},h=[],c=d(v,u,h,!1,null,null,null,null);const p=c.exports;panel.plugin("schneyra/autosave",{fields:{autosave:p}})})();