向窗口

时间:2017-11-15 11:33:03

标签: dom reason bs-webapi

我正在尝试向窗口添加一个事件监听器,但我不确定如何获取窗口。

我现在有这个。

let onUnhandledRejection = (e) => {
  /* TODO: write this */
}

WindowRe.addEventListener(
  "unhandledrejection",
  onUnhandledRejection,
  WINDOW_GOES_HERE: Dom.window
);

1 个答案:

答案 0 :(得分:1)

当前窗口对象可用Webapi.Dom.window

let onUnhandledRejection = (e) => {
  /* TODO: write this */
}

Webapi.Dom.Window.addEventListener(
  "unhandledrejection",
  onUnhandledRejection,
  Webapi.Dom.window
);

您也不应该使用WindowRe,因为它是私有API。

相关问题