Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Replace a window reference with goog.global in goog.events.Online…
Browse files Browse the repository at this point in the history
…Handler to allow it to work on workers.

RELNOTES: n/a

PiperOrigin-RevId: 528997097
Change-Id: I4bbdbe157348f91083383e75d9d3d0183904cdda
  • Loading branch information
Closure Team authored and Copybara-Service committed May 3, 2023
1 parent 1763bed commit c92fcbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion closure/goog/events/onlinehandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ goog.events.OnlineHandler = function() {
*/
this.eventHandler_ = new goog.events.EventHandler(this);

// Note: On workers, these events are not supported on all browsers. See
// https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/online_event#browser_compatibility
this.eventHandler_.listen(
window, [goog.events.EventType.ONLINE, goog.events.EventType.OFFLINE],
goog.global,
[goog.events.EventType.ONLINE, goog.events.EventType.OFFLINE],
this.handleChange_);
};
goog.inherits(goog.events.OnlineHandler, goog.events.EventTarget);
Expand Down

0 comments on commit c92fcbd

Please sign in to comment.