• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript localforage.createInstance函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中localforage.createInstance函数的典型用法代码示例。如果您正苦于以下问题:TypeScript createInstance函数的具体用法?TypeScript createInstance怎么用?TypeScript createInstance使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了createInstance函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: constructor

    /**
     * Creates an instance of GitHubService.
     * Registers Offline, Online listeners to get the
     * HTTP post/update/delete request queue
     * @memberof GitHubService
     */
    public constructor() {
        // only initially works on older Firefox
        this._IsOnline = window.navigator.onLine || !(window['mozInnerScreenX'] == null);

        this._LiveLocalForage = localforage.createInstance({name: "live"});
        this._QueueLocalForage = localforage.createInstance({name: "queue"});

        window.addEventListener("online",this.syncChangesToServer.bind(this));
        window.addEventListener("offline",this.handleOfflineEvent.bind(this));
    }
开发者ID:,项目名称:,代码行数:16,代码来源:


示例2: constructor

 constructor(params?: Partial<LocalBackendClient>) {
   super(params);
   this.client = LocalForage.createInstance({
     driver: LocalForage.INDEXEDDB,
     name: 'scripsi'
   });
 }
开发者ID:luketurner,项目名称:scripsi,代码行数:7,代码来源:local.ts


示例3: constructor

 constructor() {
   if (!Storage.INSTANCE && !Config.isServer) {
     this.storage = localforage.createInstance({
       name: 'storage',
     });
     this.storage.setItem('timestamp', new Date());
   }
   Storage.INSTANCE = this;
 }
开发者ID:danielwii,项目名称:asuna-admin,代码行数:9,代码来源:storage.ts


示例4: countBy

  filter,
  groupBy,
  length,
  pipe,
  prop,
  memoize,
  reverse,
  sortBy,
  split,
} from 'ramda';
import { MinimalWordGraph, QueryBuilder } from '../WordGraph';

import url from './TWL06.txt';

const store = localForage.createInstance({
  name: 'twl',
});

const countChars = (w: string) => countBy(split('') as any, w as any);
const groupByLength = (
  w: string[],
): {
  [key: number]: string[];
} => groupBy(length as any, w as any) as any;

const isValid = curry((rack: string, word: string) => {
  const rackCount = countChars(rack);
  const wordCount = countChars(word);

  for (let key of Object.keys(rackCount)) {
    if (wordCount[key] > rackCount[key]) {
开发者ID:kerlends,项目名称:word-solver,代码行数:31,代码来源:solver.worker.ts


示例5:

 LocalForage.defineDriver(CordovaSQLiteDriver).then(() => {
     db = LocalForage.createInstance(config);
 })
开发者ID:scunningham777,项目名称:SelecQuest,代码行数:3,代码来源:storage.ts


示例6: WebSocket

import * as localforage from 'localforage';
import * as RichText from 'rich-text';
import { Connection, types } from 'sharedb/lib/client';

types.register(RichText.type);

// Open WebSocket connection to ShareDB server
const socket = new WebSocket(getWebSocketDocUrl());
const connection = new Connection(socket);
const store = localforage.createInstance({ name: 'documents' });

addEventListener('message', event => {
  const projectId = event.data.projectId as string;
  const collection = event.data.slug as string;
  const docSetIds = event.data.docSetIds as string[];
  // update documents in cache
  for (const docSetId of docSetIds) {
    updateDocumentCache(collection, docSetId, 'source', projectId);
    updateDocumentCache(collection, docSetId, 'target', projectId);
  }
  // remove deleted documents from cache
  const toRemove: string[] = [];
  store.iterate<any, any>(value => {
    if (value.projectId === projectId && !docSetIds.includes(getDocSetId(value.id))) {
      toRemove.push(value.id);
    }
  }).then(() => {
    for (const docId of toRemove) {
      store.removeItem(docId).then(() => console.log('Removed document ' + docId + ' from cache'));
    }
  });
开发者ID:sillsdev,项目名称:web-languageforge,代码行数:31,代码来源:document-cache.worker.ts


示例7: removeItem

import * as localForage from 'localforage'

const appStore = localForage.createInstance({
  // driver: localForage.INDEXEDDB,
  name: 'AppStore',
  version: 1.0,
})

const keyRegistry = {
  session: 'session',
  trainingOfflinePuzzles: 'training.offlinePuzzles',
}

type Key = keyof typeof keyRegistry

export default {
  getItem<T>(key: Key): Promise<T | null> {
    return appStore.getItem(keyRegistry[key])
  },
  setItem<T>(key: Key, value: T): Promise<T> {
    return appStore.setItem(keyRegistry[key], value)
  },
  removeItem(key: Key): Promise<void> {
    return appStore.removeItem(keyRegistry[key])
  }
}
开发者ID:mbensley,项目名称:lichobile,代码行数:26,代码来源:asyncStorage.ts


示例8:

 LocalForage.defineDriver(CordovaSQLiteDriver).then(() => {
   this.db = LocalForage.createInstance({
     name: this.config.get('storage.name')
   });
 }).then(() => {
开发者ID:ngKit,项目名称:ngKit,代码行数:5,代码来源:local.ts


示例9: require

const localForage: LocalForage = require('localforage');

const localStorage: LocalForage = localForage.createInstance({
    driver: localForage.LOCALSTORAGE, // Force WebSQL; same as using setDriver()
    name: 'docs',
    version: 1.0,
    size: 4980736, // Size of database, in bytes. WebSQL-only for now.
    storeName: 'keyvaluepairs', // Should be alphanumeric, with underscores.
    description: 'docs localStorage description',
});
const webSql: LocalForage = localForage.createInstance({
    driver: localForage.WEBSQL, // Force WebSQL; same as using setDriver()
    name: 'docs',
    version: 1.0,
    size: 4980736, // Size of database, in bytes. WebSQL-only for now.
    storeName: 'keyvaluepairs', // Should be alphanumeric, with underscores.
    description: 'docs localStorage description',
});
const indexDB: LocalForage = localForage.createInstance({
    driver: localForage.INDEXEDDB, // Force WebSQL; same as using setDriver()
    name: 'docs',
    version: 1.0,
    size: 4980736, // Size of database, in bytes. WebSQL-only for now.
    storeName: 'keyvaluepairs', // Should be alphanumeric, with underscores.
    description: 'docs localStorage description',
});
export { localStorage, webSql, indexDB }
开发者ID:snippetmodule,项目名称:docs-search-client,代码行数:27,代码来源:storage.ts



注:本文中的localforage.createInstance函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript localforage.getItem函数代码示例发布时间:2022-05-25
下一篇:
TypeScript localforage.clear函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap