Skip to content

Commit 1e96134

Browse files
Merge pull request #109 from IABTechLab/ans-UID2-4347-remove-has-aborted-flag
Remove hasAborted variable
2 parents a87059a + 5e933ae commit 1e96134

File tree

2 files changed

+0
-14
lines changed

2 files changed

+0
-14
lines changed

src/integrationTests/basic.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -953,10 +953,6 @@ testCookieAndLocalStorage(() => {
953953
expect(xhrMock.send).toHaveBeenCalledTimes(1);
954954
expect(xhrMock.abort).toHaveBeenCalledTimes(1);
955955
});
956-
test('should prevent subsequent calls to init()', () => {
957-
uid2.abort();
958-
expect(() => uid2.init({ callback: () => {} })).toThrow();
959-
});
960956
});
961957

962958
describe('disconnect()', () => {
@@ -989,10 +985,6 @@ testCookieAndLocalStorage(() => {
989985
expect(xhrMock.send).toHaveBeenCalledTimes(1);
990986
expect(xhrMock.abort).toHaveBeenCalledTimes(1);
991987
});
992-
test('should prevent subsequent calls to init()', () => {
993-
uid2.disconnect();
994-
expect(() => uid2.init({ callback: () => {} })).toThrow();
995-
});
996988
test('should switch to unavailable state', () => {
997989
uid2.init({
998990
callback: callback,

src/sdkBase.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export abstract class SdkBase {
5555
private _opts: SdkOptions = {};
5656
private _identity: Identity | OptoutIdentity | null | undefined;
5757
private _initComplete = false;
58-
private _hasAborted = false;
5958

6059
// Sets up nearly everything, but does not run SdkLoaded callbacks - derived classes must run them.
6160
protected constructor(existingCallbacks: CallbackHandler[] | undefined, product: ProductDetails) {
@@ -176,7 +175,6 @@ export abstract class SdkBase {
176175

177176
// Note: This doesn't invoke callbacks. It's a hard, silent reset.
178177
public abort(reason?: string) {
179-
this._hasAborted = true;
180178
this._tokenPromiseHandler.rejectAllPromises(
181179
reason ?? new Error(`${this._product.name} SDK aborted.`)
182180
);
@@ -191,10 +189,6 @@ export abstract class SdkBase {
191189
if (!isSDKOptionsOrThrow(opts))
192190
throw new TypeError(`Options provided to ${this._product.name} init couldn't be validated.`);
193191

194-
if (this._hasAborted) {
195-
throw new TypeError('Calling init() once aborted or disconnected is not allowed');
196-
}
197-
198192
if (this.isInitComplete()) {
199193
const previousOpts = { ...this._opts };
200194
Object.assign(this._opts, opts);

0 commit comments

Comments
 (0)