Sha256: cd8e5da674c30f82a9cf0b4a0f920a399a3e04655ea53177a5c15345f6c52701
Contents?: true
Size: 1.26 KB
Versions: 14
Compression:
Stored size: 1.26 KB
Contents
var utils = require('../utils') /** * Binding for inheriting data from parent VMs. */ module.exports = { bind: function () { var self = this, childKey = self.arg, parentKey = self.key, compiler = self.compiler, owner = self.binding.compiler if (compiler === owner) { this.alone = true return } if (childKey) { if (!compiler.bindings[childKey]) { compiler.createBinding(childKey) } // sync changes on child back to parent compiler.observer.on('change:' + childKey, function (val) { if (compiler.init) return if (!self.lock) { self.lock = true utils.nextTick(function () { self.lock = false }) } owner.vm.$set(parentKey, val) }) } }, update: function (value) { // sync from parent if (!this.alone && !this.lock) { if (this.arg) { this.vm.$set(this.arg, value) } else if (this.vm.$data !== value) { this.vm.$data = value } } } }
Version data entries
14 entries across 14 versions & 1 rubygems