Skip to content

Commit

Permalink
release v - 4.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Jun 16, 2021
1 parent 63d1401 commit dd7c5f1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jsstore",
"version": "4.2.1",
"version": "4.2.2",
"description": "A complete IndexedDB wrapper with SQL like syntax.",
"main": "dist/npm.export.js",
"types": "dist/ts/main/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ export type TStringAny = { [key: string]: any };
export type TMiddleware = (request: WebWorkerRequest) => Promise<any>;

export type InitDbResult = {
isCreated: Boolean,
isCreated: boolean,
database?: IDataBase,
oldVersion: number,
newVersion: number
}
};
6 changes: 3 additions & 3 deletions src/main/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export class Connection extends ConnectionHelper {
return this.eventBus_.emit(EVENT.Open, db);
}).then(_ => {
return result.isCreated;
})
})
});
});
}

/**
Expand Down Expand Up @@ -245,7 +245,7 @@ export class Connection extends ConnectionHelper {
}

on(event: EVENT, eventCallBack: Function) {
this.eventBus_.on(event, eventCallBack)
this.eventBus_.on(event, eventCallBack);
}

off(event: EVENT, eventCallBack: Function) {
Expand Down
8 changes: 4 additions & 4 deletions src/main/event_bus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@ export class EventBus {
emit(event: string, ...args) {
const events = this._events[event] || [];
let index = 0;
let length = events.length;
const length = events.length;
const results = [];
const callMethod = () => {
const eventCb = events[index++];
if (eventCb) {
const result = eventCb.call(this._ctx, ...args);
return result && result.then ? result : Promise.resolve(result);
}
}
};

return new Promise<any[]>((res) => {
const checkAndCall = () => {
if (index < length) {
callMethod().then(result => {
results.push(result);
checkAndCall();
})
});
}
else {
res(results);
}
};
checkAndCall();
})
});

}

Expand Down

0 comments on commit dd7c5f1

Please sign in to comment.