MCPcopy
hub / github.com/chartjs/Chart.js / invokeCallbackWithFallback

Function invokeCallbackWithFallback

src/plugins/plugin.tooltip.js:447–455  ·  view source on GitHub ↗

* Invoke callback from object with context and arguments. * If callback returns `undefined`, then will be invoked default callback. * @param {Record<keyof typeof defaultCallbacks, Function>} callbacks * @param {keyof typeof defaultCallbacks} name * @param {*} ctx * @param {*} arg * @returns {a

(callbacks, name, ctx, arg)

Source from the content-addressed store, hash-verified

445 * @returns {any}
446 */
447function invokeCallbackWithFallback(callbacks, name, ctx, arg) {
448 const result = callbacks[name].call(ctx, arg);
449
450 if (typeof result === 'undefined') {
451 return defaultCallbacks[name].call(ctx, arg);
452 }
453
454 return result;
455}
456
457export class Tooltip extends Element {
458

Callers 6

getTitleMethod · 0.85
getBeforeBodyMethod · 0.85
getBodyMethod · 0.85
getAfterBodyMethod · 0.85
getFooterMethod · 0.85
_createItemsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected