Skip to content

Commit

Permalink
make data property read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
dmonad committed Jan 23, 2017
1 parent 1a25169 commit 50ede63
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions y-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@
*/
data: {
type: Object,
notify: true
notify: true,
readOnly: true
},
/**
* Module-name of the type to create
Expand All @@ -527,14 +528,14 @@
this.sharedType.unobserve(this._eventHandler)
}
this.sharedType = null
this.data = null
this._setData(null)
},
_sharedPropertyReady: function (type) {
this.sharedType = type
if (this.sharedType.observe != null) {
this.sharedType.observe(this._eventHandler)
}
this.data = { type: type }
this._setData({ type: type })
}
});
/**
Expand Down Expand Up @@ -600,7 +601,8 @@
*/
data: {
type: Array,
notify: true
notify: true,
readOnly: true
},
/**
* Module-name of the shared type
Expand All @@ -615,15 +617,15 @@
this.sharedType.unobserve(this._eventHandler)
this.sharedType = null
this._mutualExcluse(function () {
this.data = null
this._setData(null)
})
},
_sharedPropertyReady: function (array) {
var self = this
this.sharedType = array
this.sharedType.observe(this._eventHandler)
this._mutualExcluse(function () {
self.data = self._addObserverToYArray('data', array)
self._setData(self._addObserverToYArray('data', array))
})
}
/**
Expand Down Expand Up @@ -690,7 +692,8 @@
*/
data: {
type: Object,
notify: true
notify: true,
readOnly: true
},
/**
* Module-name of the shared type
Expand All @@ -705,15 +708,15 @@
this.sharedType.unobserve(this._eventHandler)
this.sharedType = null
this._mutualExcluse(function () {
this.data = null
this._setData(null)
})
},
_sharedPropertyReady: function (map) {
var self = this
this.sharedType = map
this.sharedType.observe(this._eventHandler)
this._mutualExcluse(function () {
self.data = self._addObserverToYMap('data', map)
self._setData(self._addObserverToYMap('data', map))
})
}
/**
Expand Down

0 comments on commit 50ede63

Please sign in to comment.