svelte-ux
Version:
- Increment version in `package.json` and commit as `Version bump to x.y.z` - `npm run publish`
37 lines (36 loc) • 1 kB
TypeScript
/**
* Apply changes to an HTMLElement with the ability to reverse.
* Useful with Svelte actions when being destroyed
*/
export default class DomTracker {
node: HTMLElement;
changes: {
classes: string[];
styles: {
property: string;
value: string;
}[];
attributes: {
qualifiedName: string;
value: string;
}[];
eventListeners: {
type: string;
listener: () => any;
}[];
actions: {
update?: (options: any) => any;
destroy?: () => any;
}[];
};
constructor(node: HTMLElement);
addClass(className: string): void;
addStyle(property: string, value: string): void;
addAttribute(qualifiedName: string, value: string): void;
addEventListener(type: string, listener: () => any): void;
addAction(action: {
update?: (options: any) => any;
destroy?: () => any;
}): void;
reset(): void;
}