Skip to content

Commit

Permalink
onChange function invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
jchris committed Mar 27, 2010
1 parent 576f07c commit 198188a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vendor/_attachments/jquery.pathbinder.js
Expand Up @@ -17,6 +17,7 @@
}

$.pathbinder = {
changeFuns : [],
paths : [],
begin : function(defaultPath) {
// this should trigger the defaultPath if there's not a path in the URL
Expand All @@ -34,6 +35,9 @@
go : function(path) {
goPath(path);
triggerOnPath(path);
},
onChange : function (fun) {
$.pathbinder.changeFuns.push(fun);
}
};

Expand All @@ -55,6 +59,7 @@
}

function triggerOnPath(path) {
$.pathbinder.changeFuns.forEach(function(fun) {fun(path)});
var pathSpec, path_params, params = {};
for (var i=0; i < $.pathbinder.paths.length; i++) {
pathSpec = $.pathbinder.paths[i];
Expand Down

0 comments on commit 198188a

Please sign in to comment.