Skip to content

textmode.js / plugins / TextmodePluginContext / extendSource

Method: extendSource()

ts
extendSource<TArgs, TReturn>(methodName, implementation): void;

Extend TextmodeSource instances with a new method. The method will be available on image, video, texture, and overlay sources.

Type Parameters

Type Parameter
TArgs extends unknown[]
TReturn

Parameters

ParameterTypeDescription
methodNamestringThe name of the method to add.
implementation(this, ...args) => TReturnThe implementation function. this will be bound to the TextmodeSource instance.

Returns

void

Example

ts
api.extendSource('edgeDetection', function() {
  // `this` is the TextmodeSource instance
  return this.conversionMode('edge');
});