source: node_modules/es-toolkit/dist/compat/util/bindAll.d.mts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 935 bytes
Line 
1import { Many } from '../_internal/Many.mjs';
2
3/**
4 * Binds methods of an object to the object itself, overwriting the existing method.
5 * Method names may be specified as individual arguments or as arrays of method names.
6 *
7 * @template T - The type of the object.
8 * @param {T} object - The object to bind methods to.
9 * @param {Array<Many<string>>} [methodNames] - The method names to bind, specified individually or in arrays.
10 * @returns {T} - Returns the object.
11 *
12 * @example
13 * const view = {
14 * 'label': 'docs',
15 * 'click': function() {
16 * console.log('clicked ' + this.label);
17 * }
18 * };
19 *
20 * bindAll(view, ['click']);
21 * jQuery(element).on('click', view.click);
22 * // => Logs 'clicked docs' when clicked.
23 *
24 * @example
25 * // Using individual method names
26 * bindAll(view, 'click');
27 * // => Same as above
28 */
29declare function bindAll<T>(object: T, ...methodNames: Array<Many<string>>): T;
30
31export { bindAll };
Note: See TracBrowser for help on using the repository browser.