Created
October 28, 2016 16:48
-
-
Save sglanzer-deprecated/a5c0c97e2b36d68f2a304d8cb5ae3946 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 Ember from 'ember' | |
export default Ember.Component.extend({ | |
one: null, | |
two: null, | |
red: null, | |
blue: null | |
}) |
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 Ember from 'ember' | |
export default Ember.Controller.extend({ | |
someHash: { | |
one: 'One', | |
two: 'Two', | |
red: 'Red', | |
blue: 'Blue' | |
} | |
}); | |
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 Ember from 'ember' | |
const { | |
assert, | |
defineProperty, | |
get, | |
isNone, | |
typeOf | |
} = Ember | |
const { | |
keys | |
} = Object | |
export function spread([source='options']) { | |
assert(`Spread must be given a property name to act on - received ${source}`, typeOf(source) === 'string') | |
return function() { | |
const target = get(this, source) | |
assert(`Failed to spread ${source} - the value of ${source} must be an object hash`, typeOf(target) === 'object') | |
keys(target).forEach(key => { | |
defineProperty(this, key, Ember.computed.readOnly(`${source}.${key}`)) | |
}) | |
} | |
} | |
export default Ember.Helper.helper(spread); |
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.10.6", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment