1
0
Fork 0
mirror of https://github.com/archtechx/alpine-typescript.git synced 2025-12-11 22:34:03 +00:00

Merge pull request #5 from rehhouari/master

Add type Alpine
This commit is contained in:
Samuel Štancl 2021-05-17 18:46:02 +02:00 committed by GitHub
commit 7b073ccb74
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,6 +24,34 @@ export abstract class AlpineComponent {
[key: string]: any;
}
export interface Alpine {
version: string;
pauseMutationObserver: boolean;
magicProperties: { [name: string]: (el: HTMLElement) => void };
ignoreFocusedForValueBinding: boolean;
onComponentInitializeds: Array<(component: AlpineComponent) => void>;
onBeforeComponentInitializeds: Array<(component: AlpineComponent) => void>;
onComponentInitialized: (
callback: (component: AlpineComponent) => void,
) => void;
onBeforeComponentInitialized: (
callback: (component: AlpineComponent) => void,
) => void;
listenForNewUninitializedComponentsAtRunTime: () => undefined;
discoverUninitializedComponents: (
callback: (rootEl: HTMLElement) => void,
el?: HTMLElement,
) => void;
discoverComponents: (callback: (rootEl: HTMLElement) => void) => void;
start: () => void;
addMagicProperty: (
name: string,
callback: ($el: HTMLElement) => void,
) => void;
clone: (component: AlpineComponent, newEl: HTMLElement) => void;
[key: string]: any;
}
export function registerComponents(components: { [name: string]: Function }): { [name: string]: ComponentConstructor } {
Object.entries(components).forEach(([name, file]) => {
component(name, file);