Common.Utils

Classes for your scripts

이 스크립트는 직접 설치하는 용도가 아닙니다. 다른 스크립트에서 메타 지시문 // @require https://update.greasyforks.org/scripts/389765/1090053/CommonUtils.js을(를) 사용하여 포함하는 라이브러리입니다.

작성자
Anton Shevchuk
버전
0.0.7
생성일
2019-09-04
갱신일
2022-09-05
크기
3.33KB
라이선스
MIT

Common Utils

Require Script

// @require https://greasyforks.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://greasyforks.org/uk/scripts/389765-common-utils

长期地址
遇到问题?请前往 GitHub 提 Issues。