mirror of
https://github.com/archtechx/alpine-typescript.git
synced 2025-12-11 22:34:03 +00:00
Type callablefunctions and turn type to interface
This commit is contained in:
parent
87b0feed75
commit
2cb79efc55
1 changed files with 16 additions and 8 deletions
24
src/index.ts
24
src/index.ts
|
|
@ -24,15 +24,19 @@ export abstract class AlpineComponent {
|
|||
[key: string]: any;
|
||||
}
|
||||
|
||||
export declare type Alpine = {
|
||||
export interface Alpine {
|
||||
version: string;
|
||||
pauseMutationObserver: boolean;
|
||||
magicProperties: { [name: string]: CallableFunction };
|
||||
magicProperties: { [name: string]: (el: HTMLElement) => void };
|
||||
ignoreFocusedForValueBinding: boolean;
|
||||
onComponentInitializeds: Array<CallableFunction>;
|
||||
onBeforeComponentInitializeds: Array<CallableFunction>;
|
||||
onComponentInitialized: (callback: CallableFunction) => void;
|
||||
onBeforeComponentInitialized: (callback: CallableFunction) => void;
|
||||
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,
|
||||
|
|
@ -40,10 +44,14 @@ export declare type Alpine = {
|
|||
) => void;
|
||||
discoverComponents: (callback: (rootEl: HTMLElement) => void) => void;
|
||||
start: () => void;
|
||||
addMagicProperty: (name: string, callback: ($el: HTMLElement) => void) => 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue