Commit 0690dbda authored by Matthias Möller's avatar Matthias Möller

Erster Service, Anfang Bau initializer

parent b6933402
export function initialize(/* appInstance */) {
// appInstance.inject('route', 'foo', 'service:foo');
}
export default {
name: 'explorviz-plugin-bci',
initialize
};
import Ember from 'ember';
export default Ember.Service.extend({
websockets : Ember.inject.services("websockets"),
init: function(){
this._super();
console.log("service started!");
},
start: function(){
let sockets = websockets.socketFor("ws://localhost:1313/");
sockets.on("open", openMessageHandler, this);
sockets.on("message", this.myMessageHandler, this);
}
openMessageHandler: function(event){
console.log("Verbindung aktiv: ", event);
},
myMessageHandler: function(event){
let data = event.data;
console.log(data);
},
});
export { default, initialize } from 'explorviz-plugin-bci/instance-initializers/explorviz-plugin-bci';
export { default } from 'explorviz-plugin-bci/services/emotiv-websocket';
import Ember from 'ember';
import { initialize } from 'dummy/instance-initializers/explorviz-plugin-bci';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';
module('Unit | Instance Initializer | explorviz plugin bci', {
beforeEach() {
Ember.run(() => {
this.application = Ember.Application.create();
this.appInstance = this.application.buildInstance();
});
},
afterEach() {
Ember.run(this.appInstance, 'destroy');
destroyApp(this.application);
}
});
// Replace this with your real tests.
test('it works', function(assert) {
initialize(this.appInstance);
// you would normally confirm the results of the initializer here
assert.ok(true);
});
import { moduleFor, test } from 'ember-qunit';
moduleFor('service:emotiv-websocket', 'Unit | Service | emotiv websocket', {
// Specify the other units that are required for this test.
// needs: ['service:foo']
});
// Replace this with your real tests.
test('it exists', function(assert) {
let service = this.subject();
assert.ok(service);
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment