Browse files

enabler convenience method

  • Loading branch information...
1 parent 2ef6933 commit eccff5aeeafbe1ecc71c1a507fc875a1a8e88100 @khrome khrome committed Jun 19, 2013
Showing with 8 additions and 1 deletion.
  1. +1 −1 package.json
  2. +7 −0 protolus-resource.js
View
2 package.json
@@ -1,7 +1,7 @@
{
"name": "protolus-resource",
"homepage": "https://github.com/Protolus/protolus-resource",
- "version": "0.0.10-alpha",
+ "version": "0.0.11-alpha",
"main": "protolus-resource.js",
"description": "a CommonJS based server-side resource delivery mechanism with client side shim",
"keywords": [
View
7 protolus-resource.js
@@ -437,6 +437,13 @@ Resource.handlers = {};
Resource.registerHandler = function(name, handler){
Resource.handlers[name] = handler;
};
+Resource.enable = function(type){
+ try{
+ //var instance = require('protolus-resource/handler-'+type).instance;
+ var instance = require('./handler-'+type).instance;
+ Resource.registerHandler(type, instance);
+ }catch(ex){ }
+};
Resource.internalRequire = function(topLevelRequire){
require.pkg.require = topLevelRequire;
};

0 comments on commit eccff5a

Please sign in to comment.