当前位置: 首页>>代码示例>>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;未经允许,请勿转载。