Last active
January 30, 2017 02:19
-
-
Save mnutt/0da967c62957768b27df3ce654a727c7 to your computer and use it in GitHub Desktop.
DDAU with slow deserializer
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'; | |
const { get, computed } = Ember; | |
function serialize(val) { | |
return JSON.stringify(val); | |
} | |
function deserialize(val) { | |
console.log('deserializing, this takes a long time...'); | |
return JSON.parse(val); | |
} | |
export default Ember.Component.extend({ | |
parsedValue: computed('value', function() { | |
return deserialize(get(this, 'value')); | |
}), | |
actions: { | |
update() { | |
let parsedValue = get(this, 'parsedValue'); | |
parsedValue.push(Math.random()+""); | |
let storedValue = serialize(parsedValue); | |
get(this, 'onupdate')(storedValue); | |
} | |
} | |
}); |
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'; | |
const { set } = Ember; | |
export default Ember.Controller.extend({ | |
value: '["hello","there"]', | |
actions: { | |
update(value) { | |
set(this, 'value', 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
{ | |
"version": "0.11.0", | |
"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.10.2", | |
"ember-data": "2.11.0", | |
"ember-template-compiler": "2.10.2", | |
"ember-testing": "2.10.2" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment