Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@yorkjs/web-page

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yorkjs/web-page - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

31

dist/web-page.esm.js
/**
* web-page.js v0.0.7
* web-page.js v0.0.8
* (c) 2021-2022 musicode

@@ -85,2 +85,8 @@ * Released under the MIT License.

}
function onPageFreeze() {
isPageFrozen = true;
}
function onPageResume() {
isPageFrozen = false;
}
const onPageEnter = debounceListener(function (event) {

@@ -112,8 +118,2 @@ if (isPageAlive) {

}
function onPageFreeze() {
isPageFrozen = true;
}
function onPageResume() {
isPageFrozen = false;
}
function init() {

@@ -141,2 +141,8 @@ }

}
if (supportEvent(document, 'freeze')) {
addDOMEventListener(document, 'freeze', onPageFreeze);
}
if (supportEvent(document, 'resume')) {
addDOMEventListener(document, 'resume', onPageResume);
}
if (supportEvent(window, 'pageshow')) {

@@ -151,9 +157,6 @@ addDOMEventListener(window, 'pageshow', onPageShow);

}
addDOMEventListener(window, 'beforeunload', onPageLeave);
if (supportEvent(window, 'freeze')) {
addDOMEventListener(window, 'freeze', onPageFreeze);
else {
// beforeunload 会阻止浏览器在页面导航缓存中缓存页面
addDOMEventListener(window, 'beforeunload', onPageLeave);
}
if (supportEvent(window, 'resume')) {
addDOMEventListener(window, 'resume', onPageResume);
}

@@ -163,5 +166,5 @@ /**

*/
const version = "0.0.7";
const version = "0.0.8";
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,d=!1,s=!1;const u={},w={};function f(n,e){return`on${e}`in n}function r(n,e,t){n.addEventListener?n.addEventListener(e,t,!0):n.attachEvent&&n.attachEvent("on"+e,t)}function a(n,e){let t;return function(){t||(n(arguments[0]),t=setTimeout((function(){t=void 0}),e))}}function h(n,e){const t={event:e,visible:o,persisted:c};u[n]=t,d&&!s&&l(n,t)}function l(n,e){const t=w[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 p=a((function(n){d||(d=!0,h("enter",n))}),200),g=a((function(n){d&&(h("leave",n),d=!1)}),200);function m(){}function b(n,e){const t=w[n]||(w[n]=[]);return t.push(e),"enter"===n&&u[n]&&l(n,u[n]),{remove(){for(let n=0,i=t.length;n<i;n++)t[n]===e&&t.splice(n,1)}}}v(),f(document,"visibilitychange")&&r(document,"visibilitychange",(function(n){v(),!0===o?h("show",n):!1===o&&h("hide",n)})),f(window,"pageshow")?r(window,"pageshow",(function(n){c=n.persisted,p(n)})):r(window,"load",p),f(window,"pagehide")&&r(window,"pagehide",(function(n){c=n.persisted,g(n)})),r(window,"beforeunload",g),f(window,"freeze")&&r(window,"freeze",(function(){s=!0})),f(window,"resume")&&r(window,"resume",(function(){s=!1}));const E="0.0.7";export{t as ENTER,e as HIDE,i as LEAVE,n as SHOW,b as addEventListener,m 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.8";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.7
* web-page.js v0.0.8
* (c) 2021-2022 musicode

@@ -91,2 +91,8 @@ * Released under the MIT License.

}
function onPageFreeze() {
isPageFrozen = true;
}
function onPageResume() {
isPageFrozen = false;
}
var onPageEnter = debounceListener(function (event) {

@@ -118,8 +124,2 @@ if (isPageAlive) {

}
function onPageFreeze() {
isPageFrozen = true;
}
function onPageResume() {
isPageFrozen = false;
}
function init() {

@@ -147,2 +147,8 @@ }

}
if (supportEvent(document, 'freeze')) {
addDOMEventListener(document, 'freeze', onPageFreeze);
}
if (supportEvent(document, 'resume')) {
addDOMEventListener(document, 'resume', onPageResume);
}
if (supportEvent(window, 'pageshow')) {

@@ -157,9 +163,6 @@ addDOMEventListener(window, 'pageshow', onPageShow);

}
addDOMEventListener(window, 'beforeunload', onPageLeave);
if (supportEvent(window, 'freeze')) {
addDOMEventListener(window, 'freeze', onPageFreeze);
else {
// beforeunload 会阻止浏览器在页面导航缓存中缓存页面
addDOMEventListener(window, 'beforeunload', onPageLeave);
}
if (supportEvent(window, 'resume')) {
addDOMEventListener(window, 'resume', onPageResume);
}

@@ -169,3 +172,3 @@ /**

*/
var version = "0.0.7";
var version = "0.0.8";

@@ -172,0 +175,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",f="leave",u=!1,r=!1,s={},c={};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 w(e,n){var i;return function(){i||(e(arguments[0]),i=setTimeout((function(){i=void 0}),n))}}function l(e,t){var o={event:t,visible:n,persisted:i};s[e]=o,u&&!r&&h(e,o)}function h(e,n){var i=c[e];if(i)for(var t=0,o=i.length;t<o;t++)i[t]&&i[t](n)}function p(){var e=document.visibilityState;n="visible"===e||"hidden"!==e&&void 0}var b=w((function(e){u||(u=!0,l(d,e))}),200),g=w((function(e){u&&(l(f,e),u=!1)}),200);p(),a(document,"visibilitychange")&&v(document,"visibilitychange",(function(e){p(),!0===n?l(t,e):!1===n&&l(o,e)})),a(window,"pageshow")?v(window,"pageshow",(function(e){i=e.persisted,b(e)})):v(window,"load",b),a(window,"pagehide")&&v(window,"pagehide",(function(e){i=e.persisted,g(e)})),v(window,"beforeunload",g),a(window,"freeze")&&v(window,"freeze",(function(){r=!0})),a(window,"resume")&&v(window,"resume",(function(){r=!1}));e.ENTER=d,e.HIDE=o,e.LEAVE=f,e.SHOW=t,e.addEventListener=function(e,n){var i=c[e]||(c[e]=[]);return i.push(n),e===d&&s[e]&&h(e,s[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.7",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.8",Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=web-page.min.js.map
{
"name": "@yorkjs/web-page",
"version": "0.0.7",
"version": "0.0.8",
"description": "web page life cycle",

@@ -5,0 +5,0 @@ "main": "dist/web-page.js",

@@ -29,3 +29,2 @@ # web-page

import * as WebPage from '@yorkjs/web-page'
WebPage.init()
WebPage.addEventListener(

@@ -32,0 +31,0 @@ WebPage.SHOW,

@@ -6,2 +6,2 @@ export { SHOW, HIDE, ENTER, LEAVE, } from './constant';

*/
export declare const version = "0.0.7";
export declare const version = "0.0.8";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc