Skip to content

Instantly share code, notes, and snippets.

// Create database
this.db = new this.loki('commhub-devices.json',
{
autosave: true,
autosaveInterval: 1000 * 60 * 10,
/*autoload: true,
autoloadCallback : this._dbLoadHandler.bind(this),*/
});
// TEST
{"filename":"commhub-devices.json","collections":[{"name":"devices","data":[{"deviceType":"dimmer","deviceName":"Dimmer","logicalAddr":20,"serialNumber":[54,53,2,31,0,12,0],"active":true,"meta":{"revision":0,"created":0,"version":0},"$loki":1},{"deviceType":"dimmer","deviceName":"Dimmer","logicalAddr":25,"serialNumber":[54,52,16,36,0,8,0],"active":true,"meta":{"revision":0,"created":0,"version":0},"$loki":2}],"idIndex":[1,2],"binaryIndices":{},"objType":"devices","dirty":false,"cachedIndex":null,"cachedBinaryIndex":null,"cachedData":null,"transactional":false,"cloneObjects":false,"asyncListeners":true,"disableChangesApi":true,"maxId":2,"DynamicViews":[{"collection":null,"name":"aciveDevices","persistent":false,"resultset":{"collection":null,"searchIsChained":true,"filteredrows":[0,1],"filterInitialized":true},"resultdata":[],"resultsdirty":true,"cachedresultset":null,"filterPipeline":[{"type":"where"}],"sortFunction":null,"sortCriteria":null,"sortDirty":false,"events":{"rebuild":[]}}],"events":{"insert":[null