browser-tabs-lock
Advanced tools
Comparing version 1.2.6 to 1.2.7
23
index.js
@@ -123,9 +123,12 @@ "use strict"; | ||
case 1: | ||
if (!(Date.now() < MAX_TIME)) return [3 /*break*/, 7]; | ||
if (!(Date.now() < MAX_TIME)) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, delay(30)]; | ||
case 2: | ||
_a.sent(); | ||
lockObj = STORAGE.getItem(STORAGE_KEY); | ||
if (!(lockObj === null)) return [3 /*break*/, 4]; | ||
if (!(lockObj === null)) return [3 /*break*/, 5]; | ||
TIMEOUT_KEY = this.id + "-" + lockKey + "-" + iat; | ||
// there is a problem if setItem happens at the exact same time for 2 different processes.. so we add some random delay here. | ||
return [4 /*yield*/, delay(Math.floor(Math.random() * 25))]; | ||
case 2: | ||
case 3: | ||
// there is a problem if setItem happens at the exact same time for 2 different processes.. so we add some random delay here. | ||
@@ -141,3 +144,3 @@ _a.sent(); | ||
return [4 /*yield*/, delay(30)]; | ||
case 3: | ||
case 4: | ||
_a.sent(); // this is to prevent race conditions. This time must be more than the time it takes for storage.setItem | ||
@@ -153,13 +156,13 @@ lockObjPostDelay = STORAGE.getItem(STORAGE_KEY); | ||
} | ||
return [3 /*break*/, 6]; | ||
case 4: | ||
return [3 /*break*/, 7]; | ||
case 5: | ||
SuperTokensLock.lockCorrector(); | ||
return [4 /*yield*/, this.waitForSomethingToChange(MAX_TIME)]; | ||
case 5: | ||
case 6: | ||
_a.sent(); | ||
_a.label = 6; | ||
case 6: | ||
_a.label = 7; | ||
case 7: | ||
iat = Date.now() + generateRandomString(4); | ||
return [3 /*break*/, 1]; | ||
case 7: return [2 /*return*/, false]; | ||
case 8: return [2 /*return*/, false]; | ||
} | ||
@@ -166,0 +169,0 @@ }); |
{ | ||
"name": "browser-tabs-lock", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "provides locking mechanism to sync across browser tabs", | ||
@@ -48,2 +48,2 @@ "main": "index.js", | ||
"homepage": "https://github.com/supertokens/browser-tabs-lock#readme" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31677
478