在餘燼項目中推動器。我很抱歉,但我發現如果很難讓我的頭繞着JS工具。如何在餘燼項目中使用餘燼推動器
這樣做的步驟。
- 內部餘燼-CLI項目:亭子安裝--save推杆
- 在broccoli.js文件添加的行:app.import( '銷售商/推杆/ DIST/pusher.js'); 在.jshintrc
"predef": { "document": true, "window": true, "MyappENV": true, "Pusher": true }
然後從git mentioned link複製餘燼-pusher.amd.js並保存在/供應商的文件夾中。
在broccoli.js文件添加的行:
var App = Ember.Application.extend({ modulePrefix: 'Myapp', // TODO: loaded via config Resolver: Resolver, PUSHER_OPTS: { key: '586f8kjhfkdf8d7f9', connection: {}, logAllEvents: true }, });
5.In app.js.
var App = Ember.Application.extend({ modulePrefix: 'Myapp', Resolver: Resolver, PUSHER_OPTS: { key: '586f8kjhfkdf8d7f9', connection: {}, logAllEvents: true } });
6.在application.js中控制器
import Ember from 'ember';
export
default Ember.Controller.extend({
PUSHER_SUBSCRIPTIONS: {
myChannel: ['my-event']
},
actions: {
myEvent: function() {
console.log('Event my event was triggered xxxxxxxxxxxxxxxxxxx');
}
}
});
我DONOT得到任何錯誤消息,但推儀表盤不顯示任何連接
app.import('vendor/ember-pusher/ember-pusher.amd.js', {
exports: {
'ember-pusher': [
'controller',
'binding',
'clientevents',
'initialize'
]
}
});