MCPcopy
hub / github.com/stemkoski/stemkoski.github.com / bindAll

Function bindAll

MathBox/mathbox-bundle.js:40334–40344  ·  view source on GitHub ↗

* Binds methods of an object to the object itself, overwriting the existing * method. Method names may be specified as individual arguments or as arrays * of method names. If no method names are provided all the function properties * of `object` will be bound. * * @static

(object)

Source from the content-addressed store, hash-verified

40332 * // => logs 'clicked docs', when the button is clicked
40333 */
40334 function bindAll(object) {
40335 var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object),
40336 index = -1,
40337 length = funcs.length;
40338
40339 while (++index < length) {
40340 var key = funcs[index];
40341 object[key] = createWrapper(object[key], 1, null, null, object);
40342 }
40343 return object;
40344 }
40345
40346 /**
40347 * Creates a function that, when called, invokes the method at `object[key]`

Callers

nothing calls this directly

Calls 3

baseFlattenFunction · 0.85
functionsFunction · 0.85
createWrapperFunction · 0.85

Tested by

no test coverage detected