How to use the @wireapp/store-engine.error.UnsupportedError function in @wireapp/store-engine

To help you get started, we’ve selected a few @wireapp/store-engine 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 wireapp / wire-web-packages / packages / store-engine-web-storage / src / WebStorageEngine.ts View on Github external
public async isSupported(): Promise {
    if (typeof window === 'undefined' || !window.localStorage) {
      const message = `LocalStorage is not available on your platform.`;
      throw new StoreEngineError.UnsupportedError(message);
    }
  }
github wireapp / wire-web-packages / packages / store-engine-bro-fs / src / index.ts View on Github external
async isSupported(): Promise {
    if (typeof window === 'undefined' || !fs.isSupported()) {
      const message = `File and Directory Entries API is not available on your platform.`;
      throw new StoreEngineError.UnsupportedError(message);
    }
  }
github wireapp / wire-web-packages / packages / store-engine-dexie / src / index.ts View on Github external
const platform = typeof global === 'undefined' ? window : global;
    if ('indexedDB' in platform) {
      return new Promise((resolve, reject) => {
        const name = 'test';
        const DBOpenRequest = platform.indexedDB.open(name);
        DBOpenRequest.onerror = error => reject(error);
        DBOpenRequest.onsuccess = () => {
          const db = DBOpenRequest.result;
          db.close();
          const deleteRequest = platform.indexedDB.deleteDatabase(name);
          deleteRequest.onerror = error => reject(error);
          deleteRequest.onsuccess = () => resolve();
        };
      });
    } else {
      return Promise.reject(new StoreEngineError.UnsupportedError('Could not find indexedDB in global scope'));
    }
  }
github wireapp / wire-web-packages / packages / store-engine-dexie / src / index.ts View on Github external
const platform = typeof global === 'undefined' ? window : global;
    if ('indexedDB' in platform) {
      return new Promise((resolve, reject) => {
        const name = 'test';
        const DBOpenRequest = platform.indexedDB.open(name);
        DBOpenRequest.onerror = error => reject(error);
        DBOpenRequest.onsuccess = () => {
          const db = DBOpenRequest.result;
          db.close();
          const deleteRequest = platform.indexedDB.deleteDatabase(name);
          deleteRequest.onerror = error => reject(error);
          deleteRequest.onsuccess = () => resolve();
        };
      });
    } else {
      return Promise.reject(new StoreEngineError.UnsupportedError('Could not find indexedDB in global scope'));
    }
  }
github wireapp / wire-web-packages / packages / store-engine-web-storage / src / WebStorageEngine.ts View on Github external
public async isSupported(): Promise {
    if (typeof window === 'undefined' || !window.localStorage) {
      const message = `LocalStorage is not available on your platform.`;
      throw new StoreEngineError.UnsupportedError(message);
    }
  }
github wireapp / wire-web-packages / packages / store-engine-sqleet / src / SQLeetEngine.ts View on Github external
async isSupported(): Promise {
    if (typeof WebAssembly === 'object' && typeof WebAssembly.instantiate === 'function') {
      const module = new WebAssembly.Module(Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00));
      if (module instanceof WebAssembly.Module) {
        if (new WebAssembly.Instance(module) instanceof WebAssembly.Instance) {
          return;
        }
      }
    }
    throw new StoreEngineError.UnsupportedError('WebAssembly is not supported.');
  }
}