Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enve: Illuminsight.Env;
}
}
}
/* eslint-enable */
if ('serviceWorker' in navigator) {
window.addEventListener('load', () => {
navigator.serviceWorker
.register('/sw.js')
.then((r) => console.log('SW', r))
.catch((e) => console.error('SW', e));
});
}
localForage.config({ driver: localForage.INDEXEDDB, name: 'illuminsight' });
render(React.createElement(hot(App)), document.getElementById('content'));
import { Component } from '@angular/core';
import { persistState } from '@datorama/akita';
import { debounceTime } from 'rxjs/operators';
import * as localForage from 'localforage';
localForage.config({
driver: localForage.INDEXEDDB,
name: 'Akita',
version: 1.0,
storeName: 'akita_playground'
});
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
ngOnInit() {
persistState({
key: 'akitaPlayground',
include: ['auth.token', 'todos'],
// storage: localForage,
applyMiddleware(
thunk,
routerMiddleware(hashHistory)
),
autoRehydrate()
);
const store = createStore(
rootReducer,
initialState,
enhancer,
);
// Configure localforage Indexeddb setting ( for redux-persist)
localforage.config({
driver : localforage.INDEXEDDB, // Force WebSQL; same as using setDriver()
name : 'bookie',
version : 1.0,
// storeName : 'store_name', // Should be alphanumeric, with underscores.
description : 'desc'
});
localforage.setDriver(localforage.INDEXEDDB);
// Create filter to whitelist only subset of the redux store
const subsetFilterTransform = createTransform(
(inboundState, key) => {
if (key ==='rawHistory') {
// Only persist rawHistoryByAccountId for history reducer
const savedState = inboundState.filter((v, k) => k === 'rawHistoryByAccountId');
return savedState;
} else {
return inboundState;
/* eslint-env browser */
const localforage = require('localforage')
localforage.config({ driver: localforage.INDEXEDDB })
const { urlBase64ToUint8Array } = require('./util')
const serviceWorkerSupported = 'serviceWorker' in navigator
const applicationServerKey = urlBase64ToUint8Array(process.env.applicationServerKey)
const getNotificationPermission = () =>
'Notification' in window ? window.Notification.permission : 'unsupported'
function fetchNewToken () {
return fetch('token')
.then((result) => result.json())
.then(({ token }) => token)
}
function getToken () {
import { fromTokenAmount, IAction } from '../utils/general';
import localforage from 'localforage'; // tslint:disable-line:import-name
import { ETH_USER } from '../constants/defaults';
import moment from 'moment';
const HORIZON = 'https://horizon-testnet.stellar.org';
const STELLAR_USER = 'GAOBZE4CZZOQEB6A43R4L36ESZXCAGDVU7V5ECM5LE4KTLDZ6A4S6CTY';
const STELLAR_USER_SECRET = 'SA5WYQ7EJNPCX5GQHZHGNHE5XZLT42SL6LAEMIVO6WKC6ZR4YENAEZQV';
const STELLAR_ISSUER = 'GAC73JYYYVPAPVCEXDOH7Y2KFT6GUSJWJKKCZM52UMIXTZG2T6D5NRRV';
const STELLAR_ISSUER_SECRET = 'SA6RJV2U5GUK3VYM5CHGATLXEJIDZ37YRF5MJDD5CGKT4LWKMGDDSOOM';
const STELLAR_DISTRIBUTOR = 'GA3V7T4P6KQJEPEZTVRUJWLZ3XB262BIWXYDZJ4SIS6AOPCX4KNIGGDH';
const STELLAR_DISTRIBUTOR_SECRET = 'SD676EDAREHFTLX4MYZCPPZDMV5D44PLP42ORGBHOD5PV5ONXPTIOTLK';
localforage.config({
driver : localforage.INDEXEDDB, // Force WebSQL; same as using setDriver()
name : 'token-swap-demo',
version : 1.0,
size : 4980736, // Size of database, in bytes. WebSQL-only for now.
storeName : 'keyvaluepairs', // Should be alphanumeric, with underscores.
description : 'stores the approval list',
});
function* getBalance() {
try {
const getWeb3 = state => state.network.web3Obj;
const web3 = yield select(getWeb3);
const address = web3.eth.accounts.wallet[0].address;
const balance = yield web3.eth.getBalance(address);
return balance;
} catch (e) {
yield put({ type: networkActions.SET_ERROR, payload: JSON.stringify(e) });
throw e;
}
saveMqttClientSettings(obj) {
Q.invoke(this.db,'setItem',obj.mcsId,obj).done();
this.loadInstanceDataDb = localforage.createInstance({name:"MQTT_LOAD_INSTANCE_DATA",driver:localforage.INDEXEDDB});
}
saveMqttLoadSettings(obj) {
Q.invoke(this.loadSettingsDb,'setItem',obj.mcsId,obj).done();
'use strict';
var localforage = require('localforage');
var toArrayBuffer = require('to-arraybuffer');
var utils = require('../../shared/utils');
var defaults = {
driver: localforage.INDEXEDDB
};
/**
* Creates a storage adapter that uses "localforage" for persistence.
* @param {(Object|string)} config - The storage configuration options.
* @param {string} [config.name='VirgilSecurityKeys'] - The storage name.
* @returns {StorageAdapter}
* */
function localforageStorage (config) {
config = utils.assign({}, defaults, config || {});
var store = localforage.createInstance(config);
return {
/**
return driverOrder.map(driver => {
switch (driver) {
case 'indexeddb':
return LocalForage.INDEXEDDB;
case 'websql':
return LocalForage.WEBSQL;
case 'localstorage':
return LocalForage.LOCALSTORAGE;
default:
return driver;
}
});
}
constructor() {
super();
this.dbWorker = new Worker('./js/MqttLoadSettingsDbWorker.js');
this.MqttLoadDataDbWorker = new Worker('./js/MqttLoadDataDbWorker.js');
this.loadDataDb = localforage.createInstance({name:MqttLoadConstants.DB_MQTT_LOAD_DATA,driver:localforage.INDEXEDDB});
this.mqttLoadSettingObjs = {};
this.connWorkers = {};
this.registerToAppDispatcher = this.registerToAppDispatcher.bind(this);
this.workerMessageListener = this.workerMessageListener.bind(this);
this.syncMqttLoadSettingsCache = this.syncMqttLoadSettingsCache.bind(this);
this.saveMqttLoadSettings = this.saveMqttLoadSettings.bind(this);
this.getAllMqttLoadSettingsData = this.getAllMqttLoadSettingsData.bind(this);
this.getMqttLoadSettingsDataByBsId = this.getMqttLoadSettingsDataByBsId.bind(this);
this.startMqttLoad = this.startMqttLoad.bind(this);
this.stopMqttLoad = this.stopMqttLoad.bind(this);
this.updateMqttLoadData = this.updateMqttLoadData.bind(this);
this.mqttLoadFinished = this.mqttLoadFinished.bind(this);
this.getMqttLoadDataByInstanceId = this.getMqttLoadDataByInstanceId.bind(this);
this.getMqttLoadDataByInstanceIds = this.getMqttLoadDataByInstanceIds.bind(this);