MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / autoBind

Function autoBind

src/content/Components/CircularGallery/CircularGallery.jsx:18–25  ·  view source on GitHub ↗
(instance)

Source from the content-addressed store, hash-verified

16}
17
18function autoBind(instance) {
19 const proto = Object.getPrototypeOf(instance);
20 Object.getOwnPropertyNames(proto).forEach(key => {
21 if (key !== 'constructor' && typeof instance[key] === 'function') {
22 instance[key] = instance[key].bind(instance);
23 }
24 });
25}
26
27const DEFAULT_FONT = 'bold 30px Figtree';
28// Figtree is not guaranteed to be available on the host page, so the component

Callers 1

constructorMethod · 0.70

Calls 1

bindMethod · 0.45

Tested by

no test coverage detected