Last active
April 3, 2022 01:35
-
-
Save IBue/a72fa70c472dfc54d03d040f0d849d17 to your computer and use it in GitHub Desktop.
ember-twiddle-2-source-binding
This file contains hidden or 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 { guidFor } from '@ember/object/internals'; | |
export default class extends Component { | |
_myValue = new Map(); | |
get myValue() { | |
let currentArg = this.args.stringArg || null; | |
let guid = guidFor(currentArg); | |
if (this._myValue.has(guid)) { | |
return this._myValue.get(guid) | |
} | |
else { | |
this._myValue.clear(); // avoid GUID reuse of primitive types (Strings) | |
return currentArg; | |
} | |
} | |
set myValue(value) { | |
this._myValue.set(guidFor(this.args.stringArg || null), value); | |
} | |
} |
This file contains hidden or 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'; | |
appInput = ''; | |
} |
This file contains hidden or 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": true, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": false | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment