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

Add type Alpine

The type may be helpful when building plugins in Typescript & just using `window.Alpine` in general
This commit is contained in:
Rafik El Hadi Houari 2021-05-17 14:53:07 +01:00 committed by GitHub
parent a86672aad6
commit 3cf5e84efc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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