Files
vanillajs-seed/node_modules/pnotify/dist/es/PNotifyNonBlock.js
2019-04-12 20:01:07 +02:00

2 lines
2.7 KiB
JavaScript

import PNotify from"./PNotify.js";function data(){return Object.assign({_notice:null,_options:{}},PNotify.modules.NonBlock.defaults)}var methods={initModule(t){this.set(t),this.doNonBlockClass()},update(){this.doNonBlockClass()},doNonBlockClass(){this.get().nonblock?this.get()._notice.addModuleClass("nonblock"):this.get()._notice.removeModuleClass("nonblock")}};function setup(t){t.key="NonBlock",t.defaults={nonblock:!1},t.init=(o=>new t({target:document.body,data:{_notice:o}})),PNotify.modules.NonBlock=t}function create_main_fragment(t,o){return{c:noop,m:noop,p:noop,d:noop}}function PNotifyNonBlock(t){init(this,t),this._state=assign(data(),t.data),this._intro=!0,this._fragment=create_main_fragment(this,this._state),t.target&&(this._fragment.c(),this._mount(t.target,t.anchor))}function noop(){}function init(t,o){t._handlers=blankObject(),t._slots=blankObject(),t._bind=o._bind,t._staged={},t.options=o,t.root=o.root||t,t.store=o.store||t.root.store,o.root||(t._beforecreate=[],t._oncreate=[],t._aftercreate=[])}function assign(t,o){for(var n in o)t[n]=o[n];return t}function destroy(t){this.destroy=noop,this.fire("destroy"),this.set=noop,this._fragment.d(!1!==t),this._fragment=null,this._state={}}function get(){return this._state}function fire(t,o){var n=t in this._handlers&&this._handlers[t].slice();if(n)for(var e=0;e<n.length;e+=1){var s=n[e];if(!s.__calling)try{s.__calling=!0,s.call(this,o)}finally{s.__calling=!1}}}function on(t,o){var n=this._handlers[t]||(this._handlers[t]=[]);return n.push(o),{cancel:function(){var t=n.indexOf(o);~t&&n.splice(t,1)}}}function set(t){this._set(assign({},t)),this.root._lock||flush(this.root)}function _set(t){var o=this._state,n={},e=!1;for(var s in t=assign(this._staged,t),this._staged={},t)this._differs(t[s],o[s])&&(n[s]=e=!0);e&&(this._state=assign(assign({},o),t),this._recompute(n,this._state),this._bind&&this._bind(n,this._state),this._fragment&&(this.fire("state",{changed:n,current:this._state,previous:o}),this._fragment.p(n,this._state),this.fire("update",{changed:n,current:this._state,previous:o})))}function _stage(t){assign(this._staged,t)}function _mount(t,o){this._fragment[this._fragment.i?"i":"m"](t,o||null)}function _differs(t,o){return t!=t?o==o:t!==o||t&&"object"==typeof t||"function"==typeof t}function blankObject(){return Object.create(null)}function flush(t){t._lock=!0,callAll(t._beforecreate),callAll(t._oncreate),callAll(t._aftercreate),t._lock=!1}function callAll(t){for(;t&&t.length;)t.shift()()}assign(PNotifyNonBlock.prototype,{destroy:destroy,get:get,fire:fire,on:on,set:set,_set:_set,_stage:_stage,_mount:_mount,_differs:_differs}),assign(PNotifyNonBlock.prototype,methods),PNotifyNonBlock.prototype._recompute=noop,setup(PNotifyNonBlock);export default PNotifyNonBlock;
//# sourceMappingURL=PNotifyNonBlock.js.map