diff --git a/app/controllers/application.js b/app/controllers/application.js new file mode 100644 index 0000000..8fbab32 --- /dev/null +++ b/app/controllers/application.js @@ -0,0 +1,12 @@ +import Controller from '@ember/controller'; +import { inject as service } from '@ember/service'; +import { alias } from '@ember/object/computed'; + +export default Controller.extend({ + + storage: service(), + + connecting: alias('storage.connecting'), + connected: alias('storage.connected') + +}); diff --git a/app/controllers/index.js b/app/controllers/index.js new file mode 100644 index 0000000..d630f31 --- /dev/null +++ b/app/controllers/index.js @@ -0,0 +1,4 @@ +import Controller from '@ember/controller'; + +export default Controller.extend({ +}); diff --git a/app/router.js b/app/router.js index d0bb009..53c53c6 100644 --- a/app/router.js +++ b/app/router.js @@ -6,7 +6,6 @@ const Router = EmberRouter.extend({ rootURL: config.rootURL }); -Router.map(function() { -}); +Router.map(function() {}); export default Router; diff --git a/app/routes/application.js b/app/routes/application.js new file mode 100644 index 0000000..6b04222 --- /dev/null +++ b/app/routes/application.js @@ -0,0 +1,5 @@ +import Route from '@ember/routing/route'; + +export default Route.extend({ + +}); diff --git a/app/routes/index.js b/app/routes/index.js new file mode 100644 index 0000000..0774ee1 --- /dev/null +++ b/app/routes/index.js @@ -0,0 +1,8 @@ +import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; + +export default Route.extend({ + + storage: service() + +}); diff --git a/app/services/storage.js b/app/services/storage.js index 5a124e9..32abc84 100644 --- a/app/services/storage.js +++ b/app/services/storage.js @@ -13,7 +13,6 @@ export default Service.extend({ const rs = new RemoteStorage({ cache: false }); - this.set('rs', rs); rs.access.claim('*', 'rw'); @@ -25,7 +24,6 @@ export default Service.extend({ const widget = new Widget(rs, { leaveOpen: true }); - this.set('widget', widget); // Attach widget to DOM widget.attach(); @@ -64,6 +62,9 @@ export default Service.extend({ this.set('connecting', true); this.set('connected', false); }); + + this.set('rs', rs); + this.set('widget', widget); }.on('init') }); diff --git a/app/styles/app.scss b/app/styles/app.scss index 14d2219..4a1cc43 100644 --- a/app/styles/app.scss +++ b/app/styles/app.scss @@ -6,3 +6,9 @@ body { font-family: sans-serif; color: #222; } + +#remotestorage-widget { + position: fixed; + top: 0.5rem; + right: 0.5rem; +} diff --git a/app/templates/application.hbs b/app/templates/application.hbs index 5230580..ba8647a 100644 --- a/app/templates/application.hbs +++ b/app/templates/application.hbs @@ -1,3 +1,13 @@ -

Welcome to Ember

+

Inspektor

+ +{{#if connecting}} + Connecting... +{{else}} + {{#if connected}} + Connected. + {{else}} + Not connected. + {{/if}} +{{/if}} {{outlet}} \ No newline at end of file diff --git a/app/templates/index.hbs b/app/templates/index.hbs new file mode 100644 index 0000000..e1a799a --- /dev/null +++ b/app/templates/index.hbs @@ -0,0 +1,3 @@ +index.hbs + +{{outlet}} \ No newline at end of file diff --git a/package.json b/package.json index 8b8b19d..2ba166c 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,6 @@ "remotestoragejs": "^1.0.0" }, "engines": { - "node": "^4.5 || 6.* || >= 7.*" + "node": "6.* || >= 7.*" } } diff --git a/tests/unit/controllers/application-test.js b/tests/unit/controllers/application-test.js new file mode 100644 index 0000000..b71b4a5 --- /dev/null +++ b/tests/unit/controllers/application-test.js @@ -0,0 +1,12 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:application', 'Unit | Controller | application', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + let controller = this.subject(); + assert.ok(controller); +}); diff --git a/tests/unit/controllers/index-test.js b/tests/unit/controllers/index-test.js new file mode 100644 index 0000000..d89d39f --- /dev/null +++ b/tests/unit/controllers/index-test.js @@ -0,0 +1,12 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('controller:index', 'Unit | Controller | index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +// Replace this with your real tests. +test('it exists', function(assert) { + let controller = this.subject(); + assert.ok(controller); +}); diff --git a/tests/unit/routes/index-test.js b/tests/unit/routes/index-test.js new file mode 100644 index 0000000..5d0f50d --- /dev/null +++ b/tests/unit/routes/index-test.js @@ -0,0 +1,11 @@ +import { moduleFor, test } from 'ember-qunit'; + +moduleFor('route:index', 'Unit | Route | index', { + // Specify the other units that are required for this test. + // needs: ['controller:foo'] +}); + +test('it exists', function(assert) { + let route = this.subject(); + assert.ok(route); +});