MCPcopy Create free account
hub / github.com/OpenIntroStat/ims / delegateMethod

Function delegateMethod

libs/htmlwidgets-1.5.3/htmlwidgets.js:98–115  ·  view source on GitHub ↗
(delegator, delegatee, methodName)

Source from the content-addressed store, hash-verified

96 //
97 // The output would be "b1", "a2".
98 function delegateMethod(delegator, delegatee, methodName) {
99 var inherited = delegator[methodName];
100 delegator[methodName] = function() {
101 var target = delegatee;
102 var method = delegatee[methodName];
103
104 // The method doesn't exist on the delegatee. Instead,
105 // call the method on the delegator, if it exists.
106 if (!method) {
107 target = delegator;
108 method = inherited;
109 }
110
111 if (method) {
112 return method.apply(target, arguments);
113 }
114 };
115 }
116
117 // Implement a vague facsimilie of jQuery's data method
118 function elementData(el, name, value) {

Callers 1

htmlwidgets.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected