Commit bd45d7d3 authored by Matthias Möller's avatar Matthias Möller

Fehlerfreie Modul installation, Einfügung von css

parent 62f188e8
export function initialize(/* application */) {
// application.inject('route', 'foo', 'service:foo');
}
export default {
name: 'exploviz-plugin-bci',
initialize
};
......@@ -5,14 +5,30 @@ export default Ember.Service.extend({
websockets : Ember.inject.service("websockets"),
init: function(){
const self = this;
this._super();
console.log("service started!");
$(document).ready(addButton);
this.start();
function addButton(){
let item = document.createElement("li");
let button = document.createElement("a");
let span = document.createElement("span");
//span.onclick = self.start;
span.className = "glyphicon glyphicon-signal";
span.dataset.type = "disconnected";
button.appendChild(span);
item.appendChild(button);
let field = document.getElementById("addon-bar");
field.appendChild(item);
}
},
start: function(){
let sockets = websockets.socketFor("ws://localhost:1313/");
sockets.on("open", openMessageHandler, this);
let sockets = this.get("websockets").socketFor("ws://localhost:1313/");
sockets.on("open", this.openMessageHandler, this);
sockets.on("message", this.myMessageHandler, this);
sockets.on("close", function(){console.log("arr");}, this);
},
openMessageHandler: function(event){
......@@ -22,7 +38,7 @@ export default Ember.Service.extend({
myMessageHandler: function(event){
let data = event.data;
console.log(data);
},
}
......
@keyframes connecting{
0% {color:grey;}
50% {color:#7FFF00;}
100% {color:grey;}
}
.glyphicon.glyphicon-signal[data-type="connected"]{
color: #7FFF00;
}
.glyphicon.glyphicon-signal[data-type="disconnected"]{
color: grey;
cursor: pointer;
}
.glyphicon.glyphicon-signal[data-type="connecting"]{
animation-name: connecting;
animation-duration: 1s;
animation-iteration-count: infinite;
cursor: wait;
}
\ No newline at end of file
export { default, initialize } from 'explorviz-plugin-bci/initializers/exploviz-plugin-bci';
......@@ -5,10 +5,32 @@ module.exports = {
name: 'explorviz-plugin-bci',
included: function(app) {
this.addons.forEach(function(addon){
if (addon.name === "ember-websocket") {
addon.included.apply(addon, [app]);
this.addons.forEach((addon) =>{
if(addon.name === "ember-websockets"){
//überschreibt eine Funktion, die einen allgemeinen Fehler verursacht
addon._readConfig =
function help(environment) {
let path = require("path");
let exists = require('exists-sync');
const project = this.parent.app.project;
const configPath = path.dirname(project.configPath());
let config = path.join(configPath, 'environment.js');
if (!path.isAbsolute(config)) {
config = path.join(project.root, config);
}
if (exists(config)) {
return require(config)(environment);
}
return {
'ember-websockets': {}
};
};
}
});
this._super.included.apply(this, arguments);
}
};
import Ember from 'ember';
import { initialize } from 'dummy/initializers/exploviz-plugin-bci';
import { module, test } from 'qunit';
import destroyApp from '../../helpers/destroy-app';
module('Unit | Initializer | exploviz plugin bci', {
beforeEach() {
Ember.run(() => {
this.application = Ember.Application.create();
this.application.deferReadiness();
});
},
afterEach() {
destroyApp(this.application);
}
});
// Replace this with your real tests.
test('it works', function(assert) {
initialize(this.application);
// you would normally confirm the results of the initializer here
assert.ok(true);
});
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