foreignStorage

2/16/2022, 9:49:50 PM

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

Yazar
UniBreakfast
Günlük kurulumlar
0
Toplam kurulumlar
14
Değerlendirmeler
0 0 0
Versiyon
1.0
Oluşturulma
16.02.2022
Güncellenme
16.02.2022
Boyut
2,45 KB
Lisans
MIT
Geçerli
Tüm siteler

foreignStorage (like localStorage but in a cloud)

(github repo with front and back source code is here)

Buy enabling this script you're getting the global object foreignStorage, which is quite similar to the well known (I hope) standard localStorage object.

Differences are:

  • localStorage stores data per page (domain), foreignStorage stores common data no matter which page you are on
  • localStorage stores data just in one browser for one user account, foreignStorage stores in the cloud (Google Sheet actually) for everybody
  • localStorage is limited by around 5Mb, foreignStorage limits are currently unknown, but I have a big hope that it is much more
  • localStorage is synchronous, foreignStorage is asyncronous (because it stores data far away in the cloud)

You and everybody else can store, overwrite and read every key/value pair from anywhere

Really. Without authorization or anything like that. Total trust. So please don't use it to store sensitive information.

foreignStorage.setItem(key, valueString)

await foreignStorage.setItem('my_unique_key', '["JSON", "stringified", "data", {"with": "some", "data": "in it"}]')

Stores new key/value pair or overwrites value of existing, if one was already stored. Returns true or throws an error.

foreignStorage.getItem(key)

await foreignStorage.getItem('my_unique_key')

Reads key/value pair and returns what was stored. Returns the string value or undefined (if key not found). Or throws an error.

foreignStorage.removeItem(key)

await foreignStorage.removeItem('my_unique_key')

Removes key/value pair if it was there. Returns true or throws an error.

foreignStorage.getLength()

await foreignStorage.getLength()

Returns the total count of key/value pairs in the foreignStorage or throws an error.

foreignStorage.listKeys()

await foreignStorage.listKeys()

Returns the list of all keys in the foreignStorage or throws an error.

foreignStorage.clear()

await foreignStorage.clear()

Removes all key/value pairs. Yours, everyone's. Returns true or throws an error.

CAUTION!!! THIS WILL SIGNIFICANTLY LOWER YOUR CARMA IF SOMEBODY'S DATA IS LOST IN THE PROCESS AND HE OR SHE WASN'T ACTUALLY READY TO LOOSE IT!

If you're going to use foreignStorage, be nice and play carefully!

(github repo with front and back source code is here)