Last active
December 4, 2019 19:24
-
-
Save bantic/017a854cea572c1b53a682ee3cfd51ef to your computer and use it in GitHub Desktop.
Ember 2.12.2 Set Mutations
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 Ember from 'ember'; | |
let num = 4; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
emberVersion: Ember.VERSION, | |
init() { | |
this._super(...arguments); | |
this.set('theSet', new Set([1,2,3])); | |
}, | |
theSetItems: Ember.computed('theSet', function() { | |
return Array.from(this.get('theSet')); | |
}), | |
theSetItemsBrackets: Ember.computed('theSet.[]', function() { | |
return Array.from(this.get('theSet')); | |
}), | |
actions: { | |
add1() { | |
let theSet = this.get('theSet'); | |
theSet.add(num++); | |
}, | |
add1AndSet() { | |
let theSet = this.get('theSet'); | |
theSet.add(num++); | |
this.set('theSet', theSet); | |
}, | |
add1AndSetNew() { | |
let theSet = this.get('theSet'); | |
theSet.add(num++); | |
this.set('theSet', new Set(theSet)); | |
}, | |
notifySet() { | |
this.notifyPropertyChange('theSet'); | |
}, | |
} | |
}); |
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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "2.12.2", | |
"ember-template-compiler": "2.12.2", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "2.12.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment