Last active
December 11, 2015 13:09
-
-
Save cjbell/4605615 to your computer and use it in GitHub Desktop.
Big Bird Controller example #1
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
var ControllerExample = BigBird.Controller.extend({ | |
// This function gets $.proxy(ied) for you automatically. | |
// That means you can call it without it losing lexical scope | |
proxied: ["myFunction"], | |
// We can subscribe to new events through the subscriptions | |
// shorthand. If $.publish("/updateVariable") gets called, then | |
// the myFunction method is invoked. | |
subscriptions: { | |
"/updateVariable", "myFunction" | |
}, | |
myVariable: true, | |
// Intialize gets called on instantiation of the object | |
initialize: function() { | |
this.myFunction(); | |
}, | |
myFunction: function() { | |
this.myVariable = false; | |
} | |
}); | |
// We can instantiate a new ControllerExample like so | |
// You can update set vraibles during this process too. | |
var ControllerInstance = new ControllerExample({ myVariable: false }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment