Temporary-Script-Storage

Sets a maximum age (minimum one day) for script storage values, after which they are deleted

Ovu skriptu ne treba izravno instalirati. To je biblioteka za druge skripte koje se uključuju u meta direktivu // @require https://update.greasyfork.org/scripts/562172/1881822/Temporary-Script-Storage.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
JasonMel
Verzija
1.0.4
Stvoreno
11.01.2026.
Ažurirano
21.07.2026.
Size
31,2 KB
Licenza
MIT (https://mit-license.org/)

Pohrana postavljena i pristupljena kroz instancu ove klase će živjeti samo dok je vijek trajanja koji ste postavili u konstruktoru, iako mora biti najmanje jedan dan. Zadana vrijednost je 30 dana. Nakon tog vremena, isteknut će i obrisati će se kada se pozove sweepExpiredEntries(), što možete zakazati sa setInterval().

Ova biblioteka nema nikakav utjecaj na pohranu skripti postavljenu izravno putem GM-ove setValue() na uobičajen način. Takva pohrana će se ponašati normalno.

Primjer korištenja:

const persistentStorage = new TTLStorage();
await persistentStorage.ready();
setInterval(() => persistentStorage.sweepExpiredEntries(), 1000 * 60 * 60 * 24);

try { 
  await persistentStorage.set("key1", "hello"); // throws
  const msg = persistentStorage.get("key1");    // fast memory read
  await persistentStorage.delete("key1");       // throws
} catch {}

Dodatno, svaki skript koji koristi ovu biblioteku mora sadržavati sljedeće metapodatke:

// @grant GM.getValue
// @grant GM.setValue
// @grant GM.deleteValue
// @grant GM.listValues
// @grant GM.info

To je potrebno jer stavljanje onoga što svaka biblioteka trebira u svoje vlastite metapodatke nije dovoljno. Skript na najvišoj razini mora osigurati potrebne @requires i @grants za sve njegove ovisnosti.