implemented observePath, fixed some inconsistencies

This commit is contained in:
Kevin Jahns
2015-10-06 19:45:29 +02:00
parent c95dae3c33
commit 1ace3e3120
5 changed files with 101 additions and 28 deletions

View File

@@ -14,16 +14,11 @@ Y({
window.yconfig = yconfig
var textarea = document.getElementById('textfield')
var contenteditable = document.getElementById('contenteditable')
yconfig.root.observe(function (events) {
for (var e in events) {
var event = events[e]
if (event.name === 'text' && (event.type === 'add' || event.type === 'update')) {
event.object.get(event.name).then(function (text) { // eslint-disable-line
text.bind(textarea)
text.bind(contenteditable)
window.ytext = text
})
}
yconfig.root.observePath(['text'], function (text) {
if (text != null) {
text.bind(textarea)
text.bind(contenteditable)
window.ytext = text
}
})
yconfig.root.set('text', Y.TextBind)