@studiometa/js-toolkit
Version:
A set of useful little bits of JavaScript to boost your project! 🚀
14 lines (13 loc) • 653 B
TypeScript
import type { BaseDecorator, BaseInterface } from '../Base/types.js';
import type { Base } from '../Base/index.js';
import type { MutationServiceOptions, MutationServiceProps } from '../services/index.js';
export type MutationDecoratorOptions = MutationServiceOptions & {
target?: (this: Base, instance: Base) => Node;
};
export interface WithMutationInterface extends BaseInterface {
mutated?(props: MutationServiceProps): void;
}
/**
* Add a mutation observer to a component.
*/
export declare function withMutation<S extends Base>(BaseClass: typeof Base, { target, ...options }?: MutationDecoratorOptions): BaseDecorator<BaseInterface, S>;