Created
September 17, 2010 22:15
-
-
Save matygo/585048 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
// The api (see http://github.com/sproutit/sproutcore/blob/quilmes/frameworks/runtime/mixins/observable.js#L616-664 ) | |
// seems to imply this should work. For me it doesn't, "context" is not being passed to the callback | |
// This 'test' should run in any sproutcore context loaded console - just copy paste | |
var contextToPass = {"key": "My Key", "blah": "pablo"}; | |
var fooObj = SC.Object.create({"foo": "Hi"}); | |
var barObj = SC.Object.create({ | |
fooDidChange: function(sender, key, value, context, rev){ | |
console.log(sender); | |
console.log(key); | |
console.log(value); | |
console.log(context); | |
console.log(rev); | |
console.log("Test context key: " + context["key"] === "My Key"); | |
console.log("Test context blah: " + context["blah"] === "pablo"); | |
} | |
}); | |
fooObj.addObserver("foo", barObj, "fooDidChange", contextToPass); | |
fooObj.set("foo", "Work Please!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment