Last active
April 28, 2021 10:19
-
-
Save tehmaestro/16647df0bdc19a9b199399b8a08d8023 to your computer and use it in GitHub Desktop.
New Twiddle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
import { inject as service } from '@ember/service'; | |
import { action } from '@ember/object'; | |
import { tracked } from '@glimmer/tracking'; | |
export default class extends Component { | |
@service session; | |
@service myService; | |
@tracked value; | |
@tracked count = 0; | |
@action | |
setWithMyService() { | |
this.myService.setData(); | |
this.value = this.session.store._data; | |
this.count++; | |
} | |
@action | |
setWithSessionThis() { | |
this.session.setDataWithThis(); | |
this.value = this.session.store._data; | |
this.count++; | |
} | |
@action | |
setWithSessionSet() { | |
this.session.setDataWithSet(); | |
this.value = this.session.store._data; | |
this.count++; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Service, { inject as service } from '@ember/service'; | |
import { set } from '@ember/object'; | |
export default class MyService extends Service { | |
@service session; | |
setData() { | |
set(this.session.data, 'setBy', 'myService'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Session from 'ember-simple-auth/services/session'; | |
import { set } from '@ember/object'; | |
export default class SessionService extends Session { | |
setDataWithThis() { | |
this.set('data.setBy', 'sessionWithThis'); | |
} | |
setDataWithSet() { | |
set(this.data, 'setBy', 'sessionWithSet'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import EphemeralStore from 'ember-simple-auth/session-stores/ephemeral'; | |
export default class ApplicationStorage extends EphemeralStore { | |
key = 'session'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0", | |
"ember-simple-auth": "3.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment