Meteor App:如何访问全局窗口对象

时间:2021-08-05 16:47:10

I am trying to port some javascript code into Meteor. It includes the following:

我试图将一些JavaScript代码移植到Meteor中。它包括以下内容:

window.AudioContext = window.AudioContext || window.webkitAudioContext;

window.AudioContext = window.AudioContext || window.webkitAudioContext;

var audioContext = new AudioContext();

var audioContext = new AudioContext();

It also uses window. in other ways.

它还使用窗口。在其他方面。

How is it possible to do this in Meteor?

怎么可能在Meteor中这样做?

Thanks

1 个解决方案

#1


As per Sindis above, it has to be in isClient block or in client/ directory - window object is reachable in those two cases.

根据上面的Sindis,它必须位于isClient块或客户端/目录中 - 在这两种情况下可以访问window对象。

#1


As per Sindis above, it has to be in isClient block or in client/ directory - window object is reachable in those two cases.

根据上面的Sindis,它必须位于isClient块或客户端/目录中 - 在这两种情况下可以访问window对象。