Last active
August 16, 2018 12:13
-
-
Save jelhan/a5ea906707f67f978454d0164b1da8ed to your computer and use it in GitHub Desktop.
ember-changeset and moment another deep dive
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'; | |
import { get } from '@ember/object'; | |
import Changeset from 'ember-changeset'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
init() { | |
this._super(...arguments); | |
class Moment {} | |
let c = new Changeset({ | |
foo: new Moment() | |
}); | |
c.set('bar', new Moment()); | |
console.log(c.get('foo') instanceof Moment); // true | |
console.log(get(c, 'foo') instanceof Moment); // false | |
console.log(c.get('bar') instanceof Moment); // true | |
console.log(get(c, 'bar') instanceof Moment); // true | |
} | |
}); |
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.0", | |
"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.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-changeset": "1.5.0-beta.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment