pubnub 和 head.js
有没有人成功地将 pubnub 和 head.js 正确集成?
Pubnub 希望我将他们的脚本放在页面底部,并带有
问题是,我的应用程序和 pubnub 的其余部分是通过 head.js 加载的,因此不断发生 JS 文件在 pubnub 订阅/发布密钥及其订阅/发布到“演示”而不是我自己的 pubnub 区域之前加载的情况...
是否有任何地方或方法可以让我关闭此
元素并直接传递凭据?Has anyone managed to integrate pubnub and head.js properly?
Pubnub expect me to put their script at the bottom of the page with a <div>
tag just before it. This ensures that the ` tag is completely loaded by the time the javascript is called last.
The thing is, the rest of my application and pubnub are loaded through head.js so it keeps happening that the JS files are loaded before the pubnub subscribe/publish key and its subscribing/publishing to 'demo' rather than my own area of pubnub...
Is there any example anywhere or way for me to just screw off this <div>
element and pass in the credentials directly?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
感谢您询问有关 PubNub 的 Head.JS 使用情况。我将帮助您快速入门。以下是如何使用 Head.JS 使用 PubNub 的示例。首先调用 head.js() 函数,就像通常包含 PubNub JS 库一样。然后在 head.js 回调中调用 PUBNUB.init({}) 函数:
就是这样!很简单吧?通过此代码,您将能够轻松地将 PubNub 脚本与 Head.JS 结合使用。如果其中可能缺少任何内容,请告诉我,我将更新代码和描述。
Thank you for asking about PubNub with Head.JS usage. I will help you get started quickly. The following is an example of how to us PubNub with Head.JS. First call the head.js() function as you normally would including the PubNub JS Lib. Then call PUBNUB.init({}) function inside the head.js callback:
That's it! Pretty simple right? With this code you will be able to use the PubNub Script with Head.JS easily. If there is anything that may be missing from this, please let me know and I will update the code and description.