Skip to content

Commit

Permalink
added code for getting this for isDbexist when using call or apply
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwalguptaofficial committed Dec 14, 2017
1 parent cdd0bc9 commit cfc6385
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
13 changes: 7 additions & 6 deletions Code/JsStore/HelperLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module JsStore {
* @param {Function} callback
* @param {Function} errCallBack
*/
export var isDbExist = function (dbInfo: DbInfo, callback: Function, errCallBack: Function = null) {
export var isDbExist = function (dbInfo: DbInfo, callback: Function = null, errCallBack: Function = null) {
var UsePromise = callback ? false : true;
if (Status.ConStatus != ConnectionStatus.UnableToStart) {
var DbName;
Expand All @@ -27,13 +27,13 @@ module JsStore {
}
else {
if (typeof dbInfo == 'string') {
getDbVersion(dbInfo, function (dbVersion) {
callback(Boolean(dbVersion));
getDbVersion.call(this, dbInfo, function (dbVersion) {
callback.call(this, Boolean(dbVersion));
});
}
else {
getDbVersion(dbInfo.DbName, function (dbVersion) {
callback(dbInfo.Table.Version <= dbVersion)
getDbVersion.call(this, dbInfo.DbName, function (dbVersion) {
callback.call(this, dbInfo.Table.Version <= dbVersion)
});
}
}
Expand Down Expand Up @@ -67,8 +67,9 @@ module JsStore {
* @param {Function} callback
*/
export var getDbVersion = function (dbName: string, callback: Function) {
var That = this;
KeyStore.get("JsStore_" + dbName + '_Db_Version', function (dbVersion) {
callback(Number(dbVersion));
callback.call(That, Number(dbVersion));
});
}

Expand Down
2 changes: 1 addition & 1 deletion Code/output/jsstore.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ declare module JsStore {
* @param {Function} callback
* @param {Function} errCallBack
*/
var isDbExist: (dbInfo: DbInfo, callback: Function, errCallBack?: Function) => any;
var isDbExist: (dbInfo: DbInfo, callback?: Function, errCallBack?: Function) => any;
/**
* get Db Version
*
Expand Down
12 changes: 7 additions & 5 deletions Code/output/jsstore.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Code/output/jsstore.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Code/output/jsstore.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Code/output/jsstore.min.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Code/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"preserveConstEnums": true,
"declaration": true
},
"exclude": [
"node_modules"
],
"files": [
//License
"License.ts",
Expand Down

0 comments on commit cfc6385

Please sign in to comment.