Skip to content

Commit b03fff4

Browse files
committed
Merge pull request #128 from aisk/reinitialize-warning
don't print reinitialize warning where initialize with same params.
2 parents cc4a2c3 + 9874d2f commit b03fff4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/utils.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ module.exports = function(AV) {
9090
*/
9191
AV.initialize = function(applicationId, applicationKey, masterKey) {
9292
if (masterKey) {
93-
throw "AV.initialize() was passed a Master Key, which is only " +
94-
"allowed from within Node.js.";
93+
throw new Error("AV.initialize() was passed a Master Key, which is only " +
94+
"allowed from within Node.js.");
9595
}
9696
AV._initialize(applicationId, applicationKey,masterKey);
9797
};
@@ -103,7 +103,10 @@ module.exports = function(AV) {
103103
* @param {String} applicationKey Your AV Application Key
104104
*/
105105
AV._initialize = function(applicationId, applicationKey, masterKey) {
106-
if (AV.applicationId !== undefined) {
106+
if (AV.applicationId !== undefined &&
107+
applicationId !== AV.applicationId &&
108+
applicationKey !== AV.applicationKey &&
109+
masterKey !== AV.masterKey) {
107110
console.warn('AVOSCloud SDK is already initialized, please don\'t reinitialize it.');
108111
}
109112
AV.applicationId = applicationId;

0 commit comments

Comments
 (0)