implemented observePath, fixed some inconsistencies
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user