當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript local-storage.get函數代碼示例

本文整理匯總了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);
  }
}
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:27,代碼來源:main.ts

示例2: paste

export function paste(): any {
  const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
  if (data && data.content) {
    return data.content;
  }
}
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:6,代碼來源:main.ts

示例3: getMetadata

export function getMetadata(): any {
  const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
  if (data && data.metadata) {
    return data.metadata;
  }
}
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:6,代碼來源:main.ts

示例4: getDescription

export function getDescription(): string {
  const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
  if (data && data.description) {
    return data.description;
  }
}
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:6,代碼來源:main.ts

示例5: getType

export function getType(): string {
  const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
  if (data && data.type) {
    return data.type;
  }
}
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:6,代碼來源:main.ts

示例6: hasData

export function hasData(): boolean {
  const data = ls.get(CLIPBOARD_KEY) as ClipboardData;
  return data && 'content' in data;
}
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:4,代碼來源:main.ts

示例7: setProp

 propInjector: setProp => setProp(prop, ls.get(CLIPBOARD_KEY)),
開發者ID:alitaheri,項目名稱:local-clipboard,代碼行數:1,代碼來源:main.ts

示例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)
  )
開發者ID:cerebral,項目名稱:cerebral,代碼行數:31,代碼來源:index.ts

示例9: load

export function load(prefix: string): PageOccurrence[] {
  return ls.get(`${prefix}_NAVIGATION_PAGES`) || [];
}
開發者ID:pretur,項目名稱:pretur,代碼行數:3,代碼來源:persist.ts

示例10: loadActivePage

export function loadActivePage(prefix: string): string | undefined {
  return ls.get(`${prefix}_NAVIGATION_ACTIVE_PAGE`) || undefined;
}
開發者ID:pretur,項目名稱:pretur,代碼行數:3,代碼來源:persist.ts


注:本文中的local-storage.get函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。