Created
August 19, 2008 23:17
-
-
Save darwin/6249 to your computer and use it in GitHub Desktop.
This file contains 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
FF3.0+FB1.2b13 | |
C1: [] observer: [] 0 | |
C1 | |
A is empty | |
C1: [] observer: [] 0 | |
C1: [] observer: [] 0 | |
A has one item | |
C1: [] observer: [] 0 | |
C1: [] observer: [] 0 | |
A has two items | |
C2 | |
A is empty | |
A has one item | |
A has two items | |
C3 | |
A is empty | |
A has one item | |
A has two items | |
C2: [] observer: [] 0 | |
C2: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C2: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C2: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C2: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C3: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C3: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C3: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C3: [] observer: [Object name=Object1, Object name=Object2] 2 | |
C3: [] observer: [Object name=Object1, Object name=Object2] 2 |
This file contains 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
function main() { | |
SC.page.awake(); | |
var arrayController = SC.ArrayController.create({ | |
exampleContentObject: "SC.Record", | |
commitChangesImmediately: YES, | |
content: [], | |
_contentObserver: function() { | |
var len = this.get('content').get('length'); | |
console.log('C1: [] observer:', this.get('content'), len); | |
}.observes('[]') | |
}); | |
var arrayController2 = SC.ArrayController.create({ | |
exampleContentObject: "SC.Record", | |
commitChangesImmediately: YES, | |
content: [], | |
_contentObserver: function() { | |
this._contentObserverWorker.bind(this).delay(0.001); | |
}.observes('[]'), | |
_contentObserverWorker: function() { | |
var len = this.get('content').get('length'); | |
console.log('C2: [] observer:', this.get('content'), len); | |
} | |
}); | |
var arrayController3 = SC.ArrayController.create({ | |
exampleContentObject: "SC.Record", | |
commitChangesImmediately: YES, | |
content: [], | |
_contentObserver: function() { | |
this._contentObserverWorker.bind(this).delay(0.2); | |
}.observes('[]'), | |
_contentObserverWorker: function() { | |
var len = this.get('content').get('length'); | |
console.log('C3: [] observer:', this.get('content'), len); | |
} | |
}); | |
console.log("C1"); | |
console.log("A is empty"); | |
arrayController.pushObject({name: "Object1"}); | |
console.log("A has one item"); | |
arrayController.pushObject({name: "Object2"}); | |
console.log("A has two items"); | |
console.log("C2"); | |
console.log("A is empty"); | |
arrayController2.pushObject({name: "Object1"}); | |
console.log("A has one item"); | |
arrayController2.pushObject({name: "Object2"}); | |
console.log("A has two items"); | |
console.log("C3"); | |
console.log("A is empty"); | |
arrayController3.pushObject({name: "Object1"}); | |
console.log("A has one item"); | |
arrayController3.pushObject({name: "Object2"}); | |
console.log("A has two items"); | |
}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment