@asgardeo/auth-spa 0.4.11 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/asgardeo-spa.production.esm.js +10 -10
- package/dist/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/asgardeo-spa.production.js +10 -10
- package/dist/asgardeo-spa.production.js.map +1 -1
- package/dist/asgardeo-spa.production.min.js +1 -1
- package/dist/asgardeo-spa.production.min.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.esm.js +5 -5
- package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.js +1 -1
- package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
- package/dist/src/helpers/authentication-helper.d.ts +3 -1
- package/dist/src/helpers/authentication-helper.d.ts.map +1 -1
- package/dist/src/helpers/authentication-helper.js +40 -0
- package/dist/src/helpers/authentication-helper.js.map +1 -1
- package/dist/src/models/http-client.d.ts +10 -1
- package/dist/src/models/http-client.d.ts.map +1 -1
- package/dist/src/utils/spa-utils.d.ts +7 -0
- package/dist/src/utils/spa-utils.d.ts.map +1 -1
- package/dist/src/utils/spa-utils.js +10 -0
- package/dist/src/utils/spa-utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/helpers/authentication-helper.ts +44 -1
- package/src/models/http-client.ts +11 -1
- package/src/utils/spa-utils.ts +15 -0
package/src/utils/spa-utils.ts
CHANGED
|
@@ -215,4 +215,19 @@ export class SPAUtils {
|
|
|
215
215
|
|
|
216
216
|
await new Promise((resolve) => setTimeout(resolve, timeToWait * 1000));
|
|
217
217
|
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Waits for a condition before executing the rest of the code in non-blocking manner.
|
|
221
|
+
*
|
|
222
|
+
* @param condition {() => boolean} - Condition to be checked.
|
|
223
|
+
* @param timeout {number} - Time in miliseconds.
|
|
224
|
+
*/
|
|
225
|
+
public static until = (
|
|
226
|
+
condition: () => boolean,
|
|
227
|
+
timeout: number = 500
|
|
228
|
+
) => {
|
|
229
|
+
const poll = (done) => (condition() ? done() : setTimeout(() => poll(done), timeout));
|
|
230
|
+
|
|
231
|
+
return new Promise(poll);
|
|
232
|
+
};
|
|
218
233
|
}
|