2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var o=arguments[e];for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(t[n]=o[n])}return t},PNotifyHistory=function(c){"use strict";c=c&&c.__esModule?c.default:c;var e,t={initModule:function(t){if(this.set(t),this.get().history){var e=this.get()._notice;e.get().destroy&&e.set({destroy:!1})}},beforeOpen:function(){var t=this.get(),e=t.maxInStack,o=t._options;if(e!==1/0){var n=o.stack;if(!1!==n&&c.notices&&c.notices.length>e){for(var i="top"===n.push,s=[],r=0,a=i?0:c.notices.length-1;i?a<c.notices.length:0<=a;i?a++:a--)-1!==["opening","open"].indexOf(c.notices[a].get()._state)&&c.notices[a].get().stack===n&&(e<=r?s.push(c.notices[a]):r++);for(var f=0;f<s.length;f++)s[f].close(!1)}}}};function o(t){var e,o;o=t,(e=this)._handlers=i(),e._slots=i(),e._bind=o._bind,e._staged={},e.options=o,e.root=o.root||e,e.store=o.store||e.root.store,o.root||(e._beforecreate=[],e._oncreate=[],e._aftercreate=[]),this._state=s(_extends({_notice:null,_options:{}},c.modules.History.defaults),t.data),this._intro=!0,this._fragment=(this._state,{c:n,m:n,p:n,d:n}),t.target&&(this._fragment.c(),this._mount(t.target,t.anchor))}function n(){}function s(t,e){for(var o in e)t[o]=e[o];return t}function i(){return Object.create(null)}function r(t){for(;t&&t.length;)t.shift()()}return s(o.prototype,{destroy:function(t){this.destroy=n,this.fire("destroy"),this.set=n,this._fragment.d(!1!==t),this._fragment=null,this._state={}},get:function(){return this._state},fire:function(t,e){var o=t in this._handlers&&this._handlers[t].slice();if(!o)return;for(var n=0;n<o.length;n+=1){var i=o[n];if(!i.__calling)try{i.__calling=!0,i.call(this,e)}finally{i.__calling=!1}}},on:function(t,e){var o=this._handlers[t]||(this._handlers[t]=[]);return o.push(e),{cancel:function(){var t=o.indexOf(e);~t&&o.splice(t,1)}}},set:function(t){if(this._set(s({},t)),this.root._lock)return;e=this.root,e._lock=!0,r(e._beforecreate),r(e._oncreate),r(e._aftercreate),e._lock=!1;var e},_set:function(t){var e=this._state,o={},n=!1;for(var i in t=s(this._staged,t),this._staged={},t)this._differs(t[i],e[i])&&(o[i]=n=!0);if(!n)return;this._state=s(s({},e),t),this._recompute(o,this._state),this._bind&&this._bind(o,this._state);this._fragment&&(this.fire("state",{changed:o,current:this._state,previous:e}),this._fragment.p(o,this._state),this.fire("update",{changed:o,current:this._state,previous:e}))},_stage:function(t){s(this._staged,t)},_mount:function(t,e){this._fragment[this._fragment.i?"i":"m"](t,e||null)},_differs:function(t,e){return t!=t?e==e:t!==e||t&&"object"===(void 0===t?"undefined":_typeof(t))||"function"==typeof t}}),s(o.prototype,t),o.prototype._recompute=n,(e=o).key="History",e.defaults={history:!0,maxInStack:1/0},e.init=function(t){return new e({target:document.body})},e.showLast=function(t){if(void 0===t&&(t=c.defaultStack),!1!==t){var e="top"===t.push,o=e?0:c.notices.length-1,n=void 0;do{if(!(n=c.notices[o]))return;o+=e?1:-1}while(n.get().stack!==t||!n.get()._modules.History.get().history||"opening"===n.get()._state||"open"===n.get()._state);n.open()}},e.showAll=function(t){if(void 0===t&&(t=c.defaultStack),!1!==t)for(var e=0;e<c.notices.length;e++){var o=c.notices[e];!0!==t&&o.get().stack!==t||!o.get()._modules.History.get().history||o.open()}},c.modules.History=e,o}(PNotify);
|
|
//# sourceMappingURL=PNotifyHistory.js.map
|