From 60f4e453195e353c33de702591b7c8e28864fdf9 Mon Sep 17 00:00:00 2001 From: Chris Joel Date: Thu, 21 Apr 2016 12:49:45 -0700 Subject: [PATCH] `carbon-mirror` -> `carbon-indexeddb-mirror` --- .../carbon-indexeddb-mirror-client.html | 2 +- .../carbon-indexeddb-mirror-worker.js | 16 +++++++--------- .../carbon-indexeddb-mirror.html | 14 ++++++-------- demo/note-app.html | 6 +++--- 4 files changed, 17 insertions(+), 21 deletions(-) rename carbon-mirror/carbon-mirror-client.html => carbon-indexeddb-mirror/carbon-indexeddb-mirror-client.html (96%) rename carbon-mirror/carbon-mirror-worker.js => carbon-indexeddb-mirror/carbon-indexeddb-mirror-worker.js (87%) rename carbon-mirror/carbon-mirror.html => carbon-indexeddb-mirror/carbon-indexeddb-mirror.html (84%) diff --git a/carbon-mirror/carbon-mirror-client.html b/carbon-indexeddb-mirror/carbon-indexeddb-mirror-client.html similarity index 96% rename from carbon-mirror/carbon-mirror-client.html rename to carbon-indexeddb-mirror/carbon-indexeddb-mirror-client.html index 77b9c96..3777159 100644 --- a/carbon-mirror/carbon-mirror-client.html +++ b/carbon-indexeddb-mirror/carbon-indexeddb-mirror-client.html @@ -8,7 +8,7 @@ let transactionId = Symbol('transactionId'); let worker = null; - Polymer.CarbonMirrorClient = class CarbonMirrorClient { + Polymer.CarbonIndexedDBMirrorClient = class CarbonIndexedDBMirrorClient { constructor(_workerUrl) { this[workerUrl] = _workerUrl; this[connected] = false; diff --git a/carbon-mirror/carbon-mirror-worker.js b/carbon-indexeddb-mirror/carbon-indexeddb-mirror-worker.js similarity index 87% rename from carbon-mirror/carbon-mirror-worker.js rename to carbon-indexeddb-mirror/carbon-indexeddb-mirror-worker.js index 19c202f..a081e4f 100644 --- a/carbon-mirror/carbon-mirror-worker.js +++ b/carbon-indexeddb-mirror/carbon-indexeddb-mirror-worker.js @@ -5,7 +5,7 @@ let dbName = Symbol('dbName'); let storeName = Symbol('storeName'); - class CarbonMirrorWorker { + class CarbonIndexedDBMirrorWorker { constructor(_dbName='carbon-mirror', _storeName='mirrored_data') { // Maybe useful in case we want to notify clients of changes.. this[dbName] = _dbName; @@ -31,11 +31,10 @@ 'error', error => console.error(error)); self.addEventListener( 'message', message => this.handleGlobalMessage(message)); - console.log('CarbonPersistenceService started...'); + console.log('CarbonIndexedDBMirrorWorker started...'); } transaction(method, key, value=null) { - console.log.apply(console, arguments); switch(method) { case 'get': return this.get(key); @@ -45,7 +44,7 @@ } get(key) { - return this.dbOpens.then((db) => { + return this.dbOpens.then(db => { return new Promise((resolve, reject) => { let transaction = db.transaction(this[storeName], 'readonly'); let store = transaction.objectStore(this[storeName]); @@ -58,7 +57,7 @@ } set(key, value) { - return this.dbOpens.then((db) => { + return this.dbOpens.then(db => { return new Promise((resolve, reject) => { let transaction = db.transaction(this[storeName], 'readwrite'); let store = transaction.objectStore(this[storeName]); @@ -71,7 +70,6 @@ } registerClient(port) { - console.log('Registering client', port) port.addEventListener( 'message', event => this.handleClientMessage(event, port)); this[clientPorts].add(port); @@ -80,7 +78,6 @@ } handleClientMessage(event, port) { - console.log(event.data); if (!event.data) { return; } @@ -106,8 +103,9 @@ } } - self.carbonMirrorWorker = new CarbonMirrorWorker(); + self.carbonIndexedDBMirrorWorker = new CarbonIndexedDBMirrorWorker(); self.addEventListener( - 'connect', event => carbonMirrorWorker.registerClient(event.ports[0])); + 'connect', + event => carbonIndexedDBMirrorWorker.registerClient(event.ports[0])); })(); diff --git a/carbon-mirror/carbon-mirror.html b/carbon-indexeddb-mirror/carbon-indexeddb-mirror.html similarity index 84% rename from carbon-mirror/carbon-mirror.html rename to carbon-indexeddb-mirror/carbon-indexeddb-mirror.html index 118b6a1..ed54e3f 100644 --- a/carbon-mirror/carbon-mirror.html +++ b/carbon-indexeddb-mirror/carbon-indexeddb-mirror.html @@ -1,14 +1,14 @@ - - + +