1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-29 16:43:09 +03:00

q.Promise -> Promise

```
find src spec -name '*.js' |
    xargs perl -i -pe 's/q\.Promise/Promise/'
```
This commit is contained in:
Richard van der Hoff
2017-07-10 16:06:04 +01:00
parent a5d3dd942e
commit b58d84fba1
3 changed files with 7 additions and 7 deletions

View File

@@ -284,7 +284,7 @@ function createDatabase(db) {
} }
function promiseifyTxn(txn) { function promiseifyTxn(txn) {
return new q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
txn.oncomplete = resolve; txn.oncomplete = resolve;
txn.onerror = reject; txn.onerror = reject;
}); });

View File

@@ -56,7 +56,7 @@ export default class IndexedDBCryptoStore {
return this._backendPromise; return this._backendPromise;
} }
this._backendPromise = new q.Promise((resolve, reject) => { this._backendPromise = new Promise((resolve, reject) => {
if (!this._indexedDB) { if (!this._indexedDB) {
reject(new Error('no indexeddb support available')); reject(new Error('no indexeddb support available'));
return; return;
@@ -107,7 +107,7 @@ export default class IndexedDBCryptoStore {
* @returns {Promise} resolves when the store has been cleared. * @returns {Promise} resolves when the store has been cleared.
*/ */
deleteAllData() { deleteAllData() {
return new q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!this._indexedDB) { if (!this._indexedDB) {
reject(new Error('no indexeddb support available')); reject(new Error('no indexeddb support available'));
return; return;

View File

@@ -44,7 +44,7 @@ function createDatabase(db) {
*/ */
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) => { /*eslint new-cap: 0*/ return Promise((resolve, reject) => { /*eslint new-cap: 0*/
const results = []; const results = [];
query.onerror = (event) => { query.onerror = (event) => {
reject(new Error("Query failed: " + event.target.errorCode)); reject(new Error("Query failed: " + event.target.errorCode));
@@ -63,7 +63,7 @@ function selectQuery(store, keyRange, resultMapper) {
} }
function promiseifyTxn(txn) { function promiseifyTxn(txn) {
return new q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
txn.oncomplete = function(event) { txn.oncomplete = function(event) {
resolve(event); resolve(event);
}; };
@@ -74,7 +74,7 @@ function promiseifyTxn(txn) {
} }
function promiseifyRequest(req) { function promiseifyRequest(req) {
return new q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
req.onsuccess = function(event) { req.onsuccess = function(event) {
resolve(event); resolve(event);
}; };
@@ -163,7 +163,7 @@ LocalIndexedDBStoreBackend.prototype = {
* @return {Promise} Resolved when the database is cleared. * @return {Promise} Resolved when the database is cleared.
*/ */
clearDatabase: function() { clearDatabase: function() {
return new q.Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(`Removing indexeddb instance: ${this._dbName}`); console.log(`Removing indexeddb instance: ${this._dbName}`);
const req = this.indexedDB.deleteDatabase(this._dbName); const req = this.indexedDB.deleteDatabase(this._dbName);