Skip to content

Commit fbd0e6d

Browse files
authored
🤖 Merge PR DefinitelyTyped#73885 Add @types/bullbone type definitions by @leonbahley
1 parent 7f88c7c commit fbd0e6d

File tree

8 files changed

+680
-0
lines changed

8 files changed

+680
-0
lines changed

types/bullbone/.npmignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!**/*.d.ts
3+
!**/*.d.cts
4+
!**/*.d.mts
5+
!**/*.d.*.ts

types/bullbone/bull.events.d.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* An Events mixin.
3+
*/
4+
declare class Events {
5+
/**
6+
* Subscribe to an event.
7+
*/
8+
on(name: string, callback: (...args: any[]) => any, context?: object): this;
9+
10+
/**
11+
* Subscribe to an event of other object.
12+
*/
13+
listenTo(other: object, name: string, callback: (...args: any[]) => any): this;
14+
15+
/**
16+
* Unsubscribe from an event or all events.
17+
*/
18+
off(name?: string, callback?: (...args: any[]) => any, context?: object): this;
19+
20+
/**
21+
* Stop listening to other object. No arguments will remove all listeners.
22+
*/
23+
stopListening(other?: object, name?: string, callback?: (...args: any[]) => any): this;
24+
25+
/**
26+
* Subscribe to an event. Fired once.
27+
*/
28+
once(name: string, callback: (...args: any[]) => any, context?: object): this;
29+
30+
/**
31+
* Subscribe to an event of other object. Fired once. Will be automatically unsubscribed on view removal.
32+
*/
33+
listenToOnce(other: object, name: string, callback: (...args: any[]) => any): this;
34+
35+
/**
36+
* Trigger an event.
37+
*/
38+
trigger(name: string, ...parameters: Array<any>): this;
39+
}
40+
41+
export default Events;

types/bullbone/bull.factory.d.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import View, { type BullViewOptions } from "./bull.view";
2+
3+
declare class Factory {
4+
defaultViewName: string;
5+
6+
constructor(options?: {
7+
defaultViewName?: string;
8+
customLoader?: object;
9+
customRenderer?: object;
10+
customLayouter?: object;
11+
customTemplator?: object;
12+
helper?: object;
13+
viewLoader?: (name: string, callback: (view: View) => void) => void;
14+
resources?: {
15+
loaders?: {
16+
template?: (name: string, callback: (content: string) => void) => void;
17+
layoutTemplate?: (name: string, callback: (content: string) => void) => void;
18+
};
19+
};
20+
preCompiledTemplates?: Record<string, () => any>;
21+
});
22+
23+
/**
24+
* Create a view.
25+
*/
26+
create(
27+
viewName: string,
28+
options?: BullViewOptions,
29+
callback?: (view: View) => void,
30+
): void;
31+
32+
/**
33+
* Prepare a view instance.
34+
*/
35+
prepare(view: View, callback?: (view: View) => void): void;
36+
}
37+
38+
export default Factory;

0 commit comments

Comments
 (0)