replace q.Promise with new Promise

This commit is contained in:
Richard van der Hoff 2017-07-13 00:37:04 +01:00
parent d5b550f89a
commit 4c5b5ca0ba
2 changed files with 5 additions and 5 deletions

View file

@ -116,7 +116,7 @@ class IndexedDBLogStore {
*/ */
connect() { connect() {
let req = this.indexedDB.open("logs"); let req = this.indexedDB.open("logs");
return q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
req.onsuccess = (event) => { req.onsuccess = (event) => {
this.db = event.target.result; this.db = event.target.result;
// Periodically flush logs to local storage / indexeddb // Periodically flush logs to local storage / indexeddb
@ -193,7 +193,7 @@ class IndexedDBLogStore {
} }
// there is no flush promise or there was but it has finished, so do // there is no flush promise or there was but it has finished, so do
// a brand new one, destroying the chain which may have been built up. // a brand new one, destroying the chain which may have been built up.
this.flushPromise = q.Promise((resolve, reject) => { this.flushPromise = new Promise((resolve, reject) => {
if (!this.db) { if (!this.db) {
// not connected yet or user rejected access for us to r/w to // not connected yet or user rejected access for us to r/w to
// the db. // the db.
@ -277,7 +277,7 @@ class IndexedDBLogStore {
} }
function deleteLogs(id) { function deleteLogs(id) {
return q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const txn = db.transaction( const txn = db.transaction(
["logs", "logslastmod"], "readwrite" ["logs", "logslastmod"], "readwrite"
); );
@ -375,7 +375,7 @@ class IndexedDBLogStore {
*/ */
function selectQuery(store, keyRange, resultMapper) { function selectQuery(store, keyRange, resultMapper) {
const query = store.openCursor(keyRange); const query = store.openCursor(keyRange);
return q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let results = []; let results = [];
query.onerror = (event) => { query.onerror = (event) => {
reject(new Error("Query failed: " + event.target.errorCode)); reject(new Error("Query failed: " + event.target.errorCode));

View file

@ -28,7 +28,7 @@ export function browserSupportsWebRTC() {
} }
export function deleteIndexedDB(dbName) { export function deleteIndexedDB(dbName) {
return new q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!window.indexedDB) { if (!window.indexedDB) {
resolve(); resolve();
return; return;