本文整理匯總了TypeScript中tinymce/core/api/util/LocalStorage.setItem函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setItem函數的具體用法?TypeScript setItem怎麽用?TypeScript setItem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setItem函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
suite.test('getItem', function () {
LocalStorage.setItem('a', '1');
LegacyUnit.equal(LocalStorage.getItem('a'), '1');
LocalStorage.setItem('a', '0');
LegacyUnit.equal(LocalStorage.getItem('a'), '0');
LegacyUnit.equal(LocalStorage.getItem('b'), null);
});
示例2: Date
const storeDraft = (editor: Editor) => {
const prefix = Settings.getAutoSavePrefix(editor);
if (!isEmpty(editor) && editor.isDirty()) {
LocalStorage.setItem(prefix + 'draft', editor.getContent({ format: 'raw', no_events: true }) as string);
LocalStorage.setItem(prefix + 'time', new Date().getTime().toString());
Events.fireStoreDraft(editor);
}
};
示例3:
const add = (key: string): void => {
// Remove duplicates first.
Arr.indexOf(cache, key).each(remove);
cache.unshift(key);
// When max size is exceeded, the oldest colors will be removed
if (cache.length > max) {
cache.pop();
}
LocalStorage.setItem(storageName, JSON.stringify(cache));
};