本文整理汇总了TypeScript中local-storage.get函数的典型用法代码示例。如果您正苦于以下问题:TypeScript get函数的具体用法?TypeScript get怎么用?TypeScript get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: copy
export function copy(data: any, options?: ClipboardOptions): void {
const payload: ClipboardData = { content: data };
if (options) {
if (options.description) {
payload.description = options.description;
}
if (options.type) {
payload.type = options.type;
}
if (options.metadata) {
payload.metadata = options.metadata;
}
}
if (localListeners.length > 0) {
const old = ls.get(CLIPBOARD_KEY);
const url = (window && window.location && window.location.href) || null;
ls.set(CLIPBOARD_KEY, payload);
localListeners.forEach(l => l(payload, old, url));
} else {
ls.set(CLIPBOARD_KEY, payload);
}
}
示例2: paste
export function paste(): any {
const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
if (data && data.content) {
return data.content;
}
}
示例3: getMetadata
export function getMetadata(): any {
const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
if (data && data.metadata) {
return data.metadata;
}
}
示例4: getDescription
export function getDescription(): string {
const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
if (data && data.description) {
return data.description;
}
}
示例5: getType
export function getType(): string {
const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
if (data && data.type) {
return data.type;
}
}
示例6: hasData
export function hasData(): boolean {
const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
return data && 'content' in data;
}
示例7: setProp
propInjector: setProp => setProp(prop, ls.get(CLIPBOARD_KEY)),
示例8: page
// @ts-ignore
import ls from 'local-storage'
import { ModuleDefinition } from 'cerebral'
import page from 'page'
import * as reactions from './reactions'
import * as sequences from './sequences'
import * as providers from './providers'
import { counts, uids, isAllChecked } from './computed'
import { State } from './types'
const state: State = {
newTodoTitle: '',
todos: ls.get('todos') || {},
filter: 'all',
editingUid: null,
counts,
uids,
isAllChecked,
}
const module: ModuleDefinition = ({ app }) => {
app.on('initialized', () =>
page.start({
hashbang: true,
})
)
page.redirect('/', '/all')
page('/:filter', ({ path, params }) =>
app.runSequence(path, sequences.changeFilter, params)
)
示例9: load
export function load(prefix: string): PageOccurrence[] {
return ls.get(`${prefix}_NAVIGATION_PAGES`) || [];
}
示例10: loadActivePage
export function loadActivePage(prefix: string): string | undefined {
return ls.get(`${prefix}_NAVIGATION_ACTIVE_PAGE`) || undefined;
}