Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions types/bullbone/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*
!**/*.d.ts
!**/*.d.cts
!**/*.d.mts
!**/*.d.*.ts
41 changes: 41 additions & 0 deletions types/bullbone/bull.events.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* An Events mixin.
*/
declare class Events {
/**
* Subscribe to an event.
*/
on(name: string, callback: (...args: any[]) => any, context?: object): this;

/**
* Subscribe to an event of other object.
*/
listenTo(other: object, name: string, callback: (...args: any[]) => any): this;

/**
* Unsubscribe from an event or all events.
*/
off(name?: string, callback?: (...args: any[]) => any, context?: object): this;

/**
* Stop listening to other object. No arguments will remove all listeners.
*/
stopListening(other?: object, name?: string, callback?: (...args: any[]) => any): this;

/**
* Subscribe to an event. Fired once.
*/
once(name: string, callback: (...args: any[]) => any, context?: object): this;

/**
* Subscribe to an event of other object. Fired once. Will be automatically unsubscribed on view removal.
*/
listenToOnce(other: object, name: string, callback: (...args: any[]) => any): this;

/**
* Trigger an event.
*/
trigger(name: string, ...parameters: Array<any>): this;
}

export default Events;
38 changes: 38 additions & 0 deletions types/bullbone/bull.factory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import View, { type BullViewOptions } from "./bull.view";

declare class Factory {
defaultViewName: string;

constructor(options?: {
defaultViewName?: string;
customLoader?: object;
customRenderer?: object;
customLayouter?: object;
customTemplator?: object;
helper?: object;
viewLoader?: (name: string, callback: (view: View) => void) => void;
resources?: {
loaders?: {
template?: (name: string, callback: (content: string) => void) => void;
layoutTemplate?: (name: string, callback: (content: string) => void) => void;
};
};
preCompiledTemplates?: Record<string, () => any>;
});

/**
* Create a view.
*/
create(
viewName: string,
options?: BullViewOptions,
callback?: (view: View) => void,
): void;

/**
* Prepare a view instance.
*/
prepare(view: View, callback?: (view: View) => void): void;
}

export default Factory;
Loading