Created
June 1, 2010 19:44
-
-
Save frekw/421384 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
var Controller = { | |
init: function(){ | |
}, | |
didClickButton: function(event){ | |
var data = "something"; | |
$.event.trigger("data:added", [data]); | |
} | |
} | |
var Model = { | |
init: function(){ | |
$.bind("data:added", $.proxy(Model, "didAddData"); | |
this.data = []; | |
}, | |
didAddData: function(data){ | |
this.data.push(data); | |
// fire an ajax request here or something | |
} | |
} | |
$("a#important-action").click($.proxy(Controller, "didClickButon")); // or fire a custom event if no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment