Skip to content

Commit

Permalink
export offline listener from sender (#2434)
Browse files Browse the repository at this point in the history
  • Loading branch information
Karlie-777 authored Oct 15, 2024
1 parent 6ead580 commit afb1db7
Show file tree
Hide file tree
Showing 3 changed files with 423 additions and 425 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export class SenderTests extends AITestClass {
QUnit.assert.equal('https://example.com', extConfig.endpointUrl, 'Channel config can be set from root config (endpointUrl)');
QUnit.assert.notEqual(654, extConfig.maxBatchSizeInBytes, 'Channel config does not equal root config option if extensionConfig field is also set');
QUnit.assert.equal(456, extConfig.maxBatchSizeInBytes, 'Channel config prioritizes extensionConfig over root config');

let offlinelistener = this._sender.getOfflineListener();
QUnit.assert.ok(offlinelistener, "offline listener exists")
}
});

Expand Down
14 changes: 14 additions & 0 deletions channels/applicationinsights-channel-js/src/Sender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,10 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {
_self.isCompletelyIdle = () => {
return !_paused && _syncFetchPayload === 0 && _self._buffer.count() === 0;
}

_self.getOfflineListener = () => {
return _offlineListener;
}

/**
* xhr state changes
Expand Down Expand Up @@ -1456,4 +1460,14 @@ export class Sender extends BaseTelemetryPlugin implements IChannelControls {
return null;
}

/**
* Get Offline listener
* @returns offlineListener
* @since 3.3.4
*/
public getOfflineListener(): IOfflineListener {
// @DynamicProtoStub - DO NOT add any code as this will be removed during packaging
return null;
}

}
Loading

0 comments on commit afb1db7

Please sign in to comment.