Socket
Socket
Sign inDemoInstall

better-state

Package Overview
Dependencies
0
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.7 to 1.1.9

22

app.js

@@ -10,2 +10,3 @@ class App {

#id = 0;
#scrollerDelay = null;
#lastPop = null;

@@ -15,3 +16,3 @@ verbose = false;

constructor() {
console.log("better-state 1.1.7");
console.log("better-state 1.1.9");
this.#index = isNaN(history.state?.index) ? 0 : history.state.index;

@@ -29,7 +30,11 @@ this.#history[this.#index] = history.state || {

try {
this.#history[this.#index].state.scrollX = window.scrollX;
this.#history[this.#index].state.scrollY = window.scrollY;
history.replaceState(this.#history[this.#index], "", location.pathname);
if (this.#scrollerDelay) window.clearTimeout(this.#scrollerDelay);
this.#scrollerDelay = window.setTimeout(() => {
this.#history[this.#index].state.scrollX = window.scrollX;
this.#history[this.#index].state.scrollY = window.scrollY;
history.replaceState(this.#history[this.#index], "", location.pathname);
//console.log(window.scrollY);
}, 333);
} catch (err) {
console.error(err);
if (this.verbose) console.error(err);
}

@@ -103,3 +108,8 @@ });

get state() {
return this.#history[this.#index]?.state ?? null;
try {
return this.#history[this.#index]?.state ?? null;
} catch (err) {
if (this.verbose) console.error(err);
return null;
}
}

@@ -106,0 +116,0 @@

{
"name": "better-state",
"version": "1.1.7",
"version": "1.1.9",
"description": "A small wrapper that encapsulates history.pushState and window.onpopstate and offers extra features - including 'No Going Back'",

@@ -5,0 +5,0 @@ "main": "app.js",

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc