Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Forked from bryanforbes/auth.js
Created February 22, 2012 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briancavalier/1885349 to your computer and use it in GitHub Desktop.
Save briancavalier/1885349 to your computer and use it in GitHub Desktop.
define(["my/module"], function(module){
return {
wire$plugin: function authPlugin(ready, destroyed, options){
var providers = options.providers || [];
return {
ready: function(resolver, proxy, wire){
console.log('COMPARING', proxy.spec.module, module.id);
if(proxy.spec.module == module.id){
wire(providers).then(
function(context){
console.log('FOUND', context);
resolver.resolve();
},
resolver.reject
);
} else {
resolver.resolve();
}
}
};
}
};
});
var wire = {
plugins: [
{ module: "wire/debug" },
{
module: "my/wire/authentication",
providers: [
["/foo", { module: "my/testProvider" }],
["/bar", { module: "my/testProvider" }]
]
}
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment