Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var scriptResource = new ScriptResource('location/of/my/script.js');
- scriptResource.call('methodName', arg1, arg2);
- var scriptResource = new ScriptResource('location/of/my/script.js');
- scriptResource.methodName(arg1, arg2);
- ScriptResource = function(scriptLocation)
- {
- this.onMethodCall = function(methodName)
- {
- this.call(arguments);
- }
- }
- obj.__noSuchMethod__ = funtion( id, args ) {
- this[id].apply( this, args );
- }
- var methods = ["foo", "bar", "baz"];
- for (var i=0; i<methods.length; i++) {
- var method_name = methods[i];
- WildCardMethodHandler[method_name] = function () {
- this.handleAllMethods(method_name);
- };
- }
- var extObj = ScriptResource('location/of/my/script.js');
- extObj('methodname')(arg1,arg2);
- function ScriptResource(file) {
- return function(method) {
- loadExternalScript(file);
- return window[method];
- }
- }
Add Comment
Please, Sign In to add comment