@yorkjs/web-page
Advanced tools
Comparing version 0.0.8 to 0.0.9
/** | ||
* web-page.js v0.0.8 | ||
* web-page.js v0.0.9 | ||
* (c) 2021-2022 musicode | ||
@@ -154,6 +154,3 @@ * Released under the MIT License. | ||
} | ||
else { | ||
// beforeunload 会阻止浏览器在页面导航缓存中缓存页面 | ||
addDOMEventListener(window, 'beforeunload', onPageLeave); | ||
} | ||
addDOMEventListener(window, 'beforeunload', onPageLeave); | ||
@@ -163,5 +160,5 @@ /** | ||
*/ | ||
const version = "0.0.8"; | ||
const version = "0.0.9"; | ||
export { ENTER, HIDE, LEAVE, SHOW, addEventListener, init, version }; | ||
//# sourceMappingURL=web-page.esm.js.map |
@@ -1,2 +0,2 @@ | ||
const n="show",e="hide",t="enter",i="leave";let o,c,u=!1,d=!1;const s={},f={};function r(n,e){return`on${e}`in n}function a(n,e,t){n.addEventListener?n.addEventListener(e,t,!0):n.attachEvent&&n.attachEvent("on"+e,t)}function h(n,e){let t;return function(){t||(n(arguments[0]),t=setTimeout((function(){t=void 0}),e))}}function l(n,e){const t={event:e,visible:o,persisted:c};s[n]=t,u&&!d&&w(n,t)}function w(n,e){const t=f[n];if(t)for(let n=0,i=t.length;n<i;n++)t[n]&&t[n](e)}function v(){const n=document.visibilityState;o="visible"===n||"hidden"!==n&&void 0}const m=h((function(n){u||(u=!0,l("enter",n))}),200),p=h((function(n){u&&(l("leave",n),u=!1)}),200);function g(){}function b(n,e){const t=f[n]||(f[n]=[]);return t.push(e),"enter"===n&&s[n]&&w(n,s[n]),{remove(){for(let n=0,i=t.length;n<i;n++)t[n]===e&&t.splice(n,1)}}}v(),r(document,"visibilitychange")&&a(document,"visibilitychange",(function(n){v(),!0===o?l("show",n):!1===o&&l("hide",n)})),r(document,"freeze")&&a(document,"freeze",(function(){d=!0})),r(document,"resume")&&a(document,"resume",(function(){d=!1})),r(window,"pageshow")?a(window,"pageshow",(function(n){c=n.persisted,m(n)})):a(window,"load",m),r(window,"pagehide")?a(window,"pagehide",(function(n){c=n.persisted,p(n)})):a(window,"beforeunload",p);const E="0.0.8";export{t as ENTER,e as HIDE,i as LEAVE,n as SHOW,b as addEventListener,g as init,E as version}; | ||
const n="show",e="hide",t="enter",i="leave";let o,c,u=!1,d=!1;const s={},f={};function r(n,e){return`on${e}`in n}function a(n,e,t){n.addEventListener?n.addEventListener(e,t,!0):n.attachEvent&&n.attachEvent("on"+e,t)}function h(n,e){let t;return function(){t||(n(arguments[0]),t=setTimeout((function(){t=void 0}),e))}}function l(n,e){const t={event:e,visible:o,persisted:c};s[n]=t,u&&!d&&w(n,t)}function w(n,e){const t=f[n];if(t)for(let n=0,i=t.length;n<i;n++)t[n]&&t[n](e)}function v(){const n=document.visibilityState;o="visible"===n||"hidden"!==n&&void 0}const m=h((function(n){u||(u=!0,l("enter",n))}),200),p=h((function(n){u&&(l("leave",n),u=!1)}),200);function g(){}function b(n,e){const t=f[n]||(f[n]=[]);return t.push(e),"enter"===n&&s[n]&&w(n,s[n]),{remove(){for(let n=0,i=t.length;n<i;n++)t[n]===e&&t.splice(n,1)}}}v(),r(document,"visibilitychange")&&a(document,"visibilitychange",(function(n){v(),!0===o?l("show",n):!1===o&&l("hide",n)})),r(document,"freeze")&&a(document,"freeze",(function(){d=!0})),r(document,"resume")&&a(document,"resume",(function(){d=!1})),r(window,"pageshow")?a(window,"pageshow",(function(n){c=n.persisted,m(n)})):a(window,"load",m),r(window,"pagehide")&&a(window,"pagehide",(function(n){c=n.persisted,p(n)})),a(window,"beforeunload",p);const E="0.0.9";export{t as ENTER,e as HIDE,i as LEAVE,n as SHOW,b as addEventListener,g as init,E as version}; | ||
//# sourceMappingURL=web-page.esm.min.js.map |
/** | ||
* web-page.js v0.0.8 | ||
* web-page.js v0.0.9 | ||
* (c) 2021-2022 musicode | ||
@@ -160,6 +160,3 @@ * Released under the MIT License. | ||
} | ||
else { | ||
// beforeunload 会阻止浏览器在页面导航缓存中缓存页面 | ||
addDOMEventListener(window, 'beforeunload', onPageLeave); | ||
} | ||
addDOMEventListener(window, 'beforeunload', onPageLeave); | ||
@@ -169,3 +166,3 @@ /** | ||
*/ | ||
var version = "0.0.8"; | ||
var version = "0.0.9"; | ||
@@ -172,0 +169,0 @@ exports.ENTER = ENTER; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).WebPage={})}(this,(function(e){"use strict";var n,i,t="show",o="hide",d="enter",u="leave",f=!1,r=!1,c={},s={};function a(e,n){return"on"+n in e}function v(e,n,i){e.addEventListener?e.addEventListener(n,i,!0):e.attachEvent&&e.attachEvent("on"+n,i)}function l(e,n){var i;return function(){i||(e(arguments[0]),i=setTimeout((function(){i=void 0}),n))}}function h(e,t){var o={event:t,visible:n,persisted:i};c[e]=o,f&&!r&&p(e,o)}function p(e,n){var i=s[e];if(i)for(var t=0,o=i.length;t<o;t++)i[t]&&i[t](n)}function w(){var e=document.visibilityState;n="visible"===e||"hidden"!==e&&void 0}var m=l((function(e){f||(f=!0,h(d,e))}),200),b=l((function(e){f&&(h(u,e),f=!1)}),200);w(),a(document,"visibilitychange")&&v(document,"visibilitychange",(function(e){w(),!0===n?h(t,e):!1===n&&h(o,e)})),a(document,"freeze")&&v(document,"freeze",(function(){r=!0})),a(document,"resume")&&v(document,"resume",(function(){r=!1})),a(window,"pageshow")?v(window,"pageshow",(function(e){i=e.persisted,m(e)})):v(window,"load",m),a(window,"pagehide")?v(window,"pagehide",(function(e){i=e.persisted,b(e)})):v(window,"beforeunload",b);e.ENTER=d,e.HIDE=o,e.LEAVE=u,e.SHOW=t,e.addEventListener=function(e,n){var i=s[e]||(s[e]=[]);return i.push(n),e===d&&c[e]&&p(e,c[e]),{remove:function(){for(var e=0,t=i.length;e<t;e++)i[e]===n&&i.splice(e,1)}}},e.init=function(){},e.version="0.0.8",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).WebPage={})}(this,(function(e){"use strict";var n,i,t="show",o="hide",d="enter",u="leave",f=!1,r=!1,c={},s={};function a(e,n){return"on"+n in e}function v(e,n,i){e.addEventListener?e.addEventListener(n,i,!0):e.attachEvent&&e.attachEvent("on"+n,i)}function l(e,n){var i;return function(){i||(e(arguments[0]),i=setTimeout((function(){i=void 0}),n))}}function h(e,t){var o={event:t,visible:n,persisted:i};c[e]=o,f&&!r&&p(e,o)}function p(e,n){var i=s[e];if(i)for(var t=0,o=i.length;t<o;t++)i[t]&&i[t](n)}function w(){var e=document.visibilityState;n="visible"===e||"hidden"!==e&&void 0}var m=l((function(e){f||(f=!0,h(d,e))}),200),b=l((function(e){f&&(h(u,e),f=!1)}),200);w(),a(document,"visibilitychange")&&v(document,"visibilitychange",(function(e){w(),!0===n?h(t,e):!1===n&&h(o,e)})),a(document,"freeze")&&v(document,"freeze",(function(){r=!0})),a(document,"resume")&&v(document,"resume",(function(){r=!1})),a(window,"pageshow")?v(window,"pageshow",(function(e){i=e.persisted,m(e)})):v(window,"load",m),a(window,"pagehide")&&v(window,"pagehide",(function(e){i=e.persisted,b(e)})),v(window,"beforeunload",b);e.ENTER=d,e.HIDE=o,e.LEAVE=u,e.SHOW=t,e.addEventListener=function(e,n){var i=s[e]||(s[e]=[]);return i.push(n),e===d&&c[e]&&p(e,c[e]),{remove:function(){for(var e=0,t=i.length;e<t;e++)i[e]===n&&i.splice(e,1)}}},e.init=function(){},e.version="0.0.9",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=web-page.min.js.map |
{ | ||
"name": "@yorkjs/web-page", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "web page life cycle", | ||
@@ -5,0 +5,0 @@ "main": "dist/web-page.js", |
@@ -6,2 +6,2 @@ export { SHOW, HIDE, ENTER, LEAVE, } from './constant'; | ||
*/ | ||
export declare const version = "0.0.8"; | ||
export declare const version = "0.0.9"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15533
358