How to use the lokijs/src/loki-indexed-adapter.js function in lokijs

To help you get started, we’ve selected a few lokijs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chronologic / eth-alarm-clock-dapp / app / services / network-aware-storage.js View on Github external
_getStorageAdapter() {
    if (LokiIndexedAdapter.prototype.checkAvailability()) {
      return new LokiIndexedAdapter();
    }

    return new LokiMemoryAdapter();
  }
github chronologic / eth-alarm-clock-dapp / app / js / eac-worker.js View on Github external
async start(options) {
    const { customProviderUrl, network, dayAccountAddress } = options;
    this.network = network;
    this.dayAccountAddress = dayAccountAddress;
    this.keystore = options.keystore;

    const providerUrl = customProviderUrl !== null ? customProviderUrl : this.network.endpoint;

    const logger = new WorkerLogger(options.logLevel, this.logs);

    const persistenceAdapter = new LokiIndexedAdapter(options.network.id);
    const browserDB = new Loki('stats.db', {
      adapter: persistenceAdapter,
      autoload: true,
      autosave: true,
      autosaveInterval: 4000
    });

    for (let key of Object.keys(options.economicStrategy)) {
      if (options.economicStrategy[key]) {
        options.economicStrategy[key] = new BigNumber(options.economicStrategy[key]);
      }
    }

    this.config = new Config({
      providerUrl,
      claiming: options.claiming,