(function() {
Utility = {
proxy: function (object, method, parameters) {
if('object' === typeof object && 'function' === typeof method) {
return method.apply(object, parameters);
}
throw new Error('Input data is incorrect');
}
};
})();
A very simple implementation of proxy in Javascript.
Example: https://jsfiddle.net/5ubf47br/1/
Read more about proxy pattern here: https://sourcemaking.com/design_patterns/proxy
Example: https://jsfiddle.net/5ubf47br/1/
Read more about proxy pattern here: https://sourcemaking.com/design_patterns/proxy
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.