-
-
Save matt-morris/954d0f4a9e73297eb566c3f4e46345c2 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({ | |
actions: { | |
update(key, value) { | |
this.update(key, value) | |
} | |
} | |
}); | |
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({ | |
path: 'obj', | |
update(key, value) { | |
if (this.get('parent')) { | |
console.log('sending to parent...', key) | |
this.get('parent').update(key, value) | |
} | |
else { | |
console.log('setting: ', key, value) | |
this.set(key, value) | |
// this.notifyPropertyChange(key) | |
} | |
}, | |
actions: { | |
update(key, value) { | |
this.update(key, value) | |
console.log('after:', this.get('obj')) | |
} | |
} | |
}); |
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({ | |
appName: 'Ember Twiddle', | |
actions: { | |
update(key, value) { | |
console.log(`updating ${key} to ${value}`); | |
this.model.set(`variables.${key}`, value); | |
} | |
} | |
}); |
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 function isObject(params/*, hash*/) { | |
return params[0] && typeof params[0] === 'object'; | |
} | |
export default Ember.Helper.helper(isObject); |
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 function toJson(params/*, hash*/) { | |
return JSON.stringify(params, null, 2); | |
} | |
export default Ember.Helper.helper(toJson); |
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.Route.extend({ | |
model() { | |
return Ember.Object.create({ | |
"variables": { | |
"foo": "bar", | |
"styles": { | |
"colors": { | |
"red": "#e3342f", | |
"green": "#38c172", | |
"blue": "#3490dc" | |
} | |
} | |
}, | |
"pages": [ | |
{ | |
"route": "/", | |
"body": [ | |
{ | |
"type": "partial", | |
"name": "header" | |
}, | |
{ | |
"type": "tag", | |
"name": "main", | |
"children": [ | |
{ | |
"type": "tag", | |
"name": "p", | |
"attributes": { | |
"class": "py-4" | |
}, | |
"children": [ | |
{ | |
"type": "text", | |
"value": "lorem ipsum blah blah blah" | |
} | |
] | |
} | |
] | |
} | |
] | |
} | |
] | |
}); | |
} | |
}); |
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.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": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "3.4.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment