2.0.3 • Published 7 years ago

dotjs-cache v2.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

dotjs-cache

なにこれ

.jsファイルをXHRで取得して実行する。
成功すればlocalStorageにキャッシュして次からはそれを使う。

使い方

$ npm i -s dotjs-cache

Promiseインスタンスを返す。

import dotjsCache from 'dotjs-cache';

dotjsCache('http://example.com/hoge.js').then( (arg)=>{
	console.log('hoge');
});

Options

第二引数のオブジェクトで指定する。

const promise = dotjsCache(url, {
	expire: {hour: 3}
});
keyvalue (default)description
cachetrueキャッシュ使用の有無
exectrue.jsファイル実行の有無
expire{date: 1}キャッシュ期限を{key: number}で指定。詳しくは honeo/date-changer
fallbackfalse失敗時の通常読み込み(scriptElement.src)の有無
withCredentialsfalsewithCredentialsの有無
2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago