Created
January 24, 2010 06:09
-
-
Save ynniv/285042 to your computer and use it in GitHub Desktop.
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
/** @private - setup observer on init if needed. */ | |
init: function() { | |
sc_super(); | |
if (this.get('content')) this._scoc_contentDidChange(); | |
if (this.get('observableContent')) this._scoc_observableContentDidChange(); | |
}, | |
_scoc_contentDidChange: function () { | |
var last = this._scoc_content, | |
cur = this.get('content'); | |
if (last !== cur) { | |
var cofunc = this._scoc_contentObjectsDidChange; | |
if (last && last.isEnumerable) last.removeObserver('[]', this, cofunc); | |
if (cur && cur.isEnumerable) cur.addObserver('[]', this, cofunc); | |
} | |
}.observes("content"), | |
_scoc_contentObjectsDidChange: function () { | |
this.propertyDidChange('content'); | |
}, | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment