【发布时间】:2018-02-18 14:00:11
【问题描述】:
这是在原生html中添加推送器的js代码
<head>
<title>Pusher Test</title>
<script src="https://js.pusher.com/4.1/pusher.min.js"></script>
<script>
// Enable pusher logging - don't include this in production
Pusher.logToConsole = true;
var pusher = new Pusher('MY_PUSHER_KEY', {
cluster: 'MY_CLUSTER',
encrypted: true
});
var channel = pusher.subscribe('my-channel');
channel.bind('my-event', function(data) {
alert(data.message);
});
我如何将上面的 js 脚本添加到我的 Angular 组件之一,以便他们可以订阅该频道? 非常感谢那些回答这个问题的人,非常感谢!
【问题讨论】:
标签: javascript typescript angular5 pusher pusher-js