Common.Utils

Classes for your scripts

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://update.greasyfork.dpdns.org/scripts/389765/1090053/CommonUtils.js

लेखक
Anton Shevchuk
आवृत्ती
0.0.7
बनवली
2019-09-04
अपडेट केली
2022-09-05
आकार
3.33 KB
License
MIT

Common Utils

Require Script

// @require https://greasyfork.dpdns.org/scripts/389765-common-utils/code/CommonUtils.js?version=XXX

See last available version on the GreasyFork homepage

Container

Cache

let CacheInstance = new SimpleCache();
let result = null;
if (CacheInstance.has('key')) {
  result = CacheInstance.get('key');
} else {
  result = await $.ajax('url');
  CacheInstance.set('key', result);
}

Settings

Load settings

let SettingsInstance = new Settings('script name', {'default':'settings'});

Save settings

With jQuery:

$(window).on('beforeunload', () => SettingsInstance.save() );

Links

Author homepage: http://anton.shevchuk.name/
Script homepage: https://github.com/AntonShevchuk/common.utils
GreasyFork: https://greasyfork.dpdns.org/uk/scripts/389765-common-utils

长期地址
遇到问题?请前往 GitHub 提 Issues,或加Q群1031348184

赞助商

Fishcpy

广告

Rainyun

一年攒够 12 元

云驰互联

云驰互联