typedoc 0.26.0-beta.5 → 0.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/index.d.ts +5 -6
  2. package/dist/index.js +1 -2
  3. package/dist/lib/application-events.d.ts +3 -3
  4. package/dist/lib/application.d.ts +9 -4
  5. package/dist/lib/application.js +14 -4
  6. package/dist/lib/converter/comments/parser.js +7 -3
  7. package/dist/lib/converter/comments/textParser.d.ts +12 -1
  8. package/dist/lib/converter/comments/textParser.js +72 -25
  9. package/dist/lib/converter/components.d.ts +1 -1
  10. package/dist/lib/converter/context.d.ts +0 -10
  11. package/dist/lib/converter/context.js +0 -12
  12. package/dist/lib/converter/converter.d.ts +22 -2
  13. package/dist/lib/converter/converter.js +0 -1
  14. package/dist/lib/converter/factories/index-signature.js +1 -1
  15. package/dist/lib/converter/factories/signature.js +5 -5
  16. package/dist/lib/converter/index.d.ts +1 -1
  17. package/dist/lib/converter/jsdoc.js +1 -1
  18. package/dist/lib/converter/plugins/CategoryPlugin.js +2 -4
  19. package/dist/lib/converter/plugins/CommentPlugin.js +12 -11
  20. package/dist/lib/converter/plugins/GroupPlugin.js +8 -10
  21. package/dist/lib/converter/plugins/ImplementsPlugin.js +4 -4
  22. package/dist/lib/converter/plugins/InheritDocPlugin.js +1 -1
  23. package/dist/lib/converter/plugins/LinkResolverPlugin.js +2 -2
  24. package/dist/lib/converter/plugins/PackagePlugin.js +7 -11
  25. package/dist/lib/converter/plugins/SourcePlugin.js +4 -6
  26. package/dist/lib/converter/plugins/TypePlugin.js +4 -8
  27. package/dist/lib/converter/types.js +6 -6
  28. package/dist/lib/internationalization/locales/jp.cjs +15 -1
  29. package/dist/lib/internationalization/locales/jp.d.cts +15 -1
  30. package/dist/lib/internationalization/locales/ko.cjs +154 -0
  31. package/dist/lib/internationalization/locales/ko.d.cts +153 -0
  32. package/dist/lib/internationalization/locales/zh.cjs +15 -1
  33. package/dist/lib/internationalization/locales/zh.d.cts +15 -1
  34. package/dist/lib/internationalization/translatable.d.ts +2 -1
  35. package/dist/lib/internationalization/translatable.js +3 -1
  36. package/dist/lib/models/FileRegistry.d.ts +9 -4
  37. package/dist/lib/models/FileRegistry.js +6 -1
  38. package/dist/lib/models/comments/comment.d.ts +2 -2
  39. package/dist/lib/models/reflections/declaration.js +1 -0
  40. package/dist/lib/models/reflections/project.js +1 -1
  41. package/dist/lib/output/components.d.ts +1 -1
  42. package/dist/lib/output/components.js +3 -5
  43. package/dist/lib/output/events.d.ts +6 -13
  44. package/dist/lib/output/events.js +7 -17
  45. package/dist/lib/output/index.d.ts +1 -1
  46. package/dist/lib/output/plugins/AssetsPlugin.d.ts +1 -0
  47. package/dist/lib/output/plugins/AssetsPlugin.js +13 -15
  48. package/dist/lib/output/plugins/IconsPlugin.js +1 -3
  49. package/dist/lib/output/plugins/JavascriptIndexPlugin.d.ts +0 -8
  50. package/dist/lib/output/plugins/JavascriptIndexPlugin.js +4 -18
  51. package/dist/lib/output/plugins/NavigationPlugin.js +2 -5
  52. package/dist/lib/output/plugins/SitemapPlugin.js +3 -3
  53. package/dist/lib/output/renderer.d.ts +11 -4
  54. package/dist/lib/output/renderer.js +11 -21
  55. package/dist/lib/output/themes/MarkedPlugin.js +4 -4
  56. package/dist/lib/output/themes/default/DefaultThemeRenderContext.d.ts +4 -5
  57. package/dist/lib/output/themes/default/DefaultThemeRenderContext.js +0 -2
  58. package/dist/lib/output/themes/default/layouts/default.js +0 -1
  59. package/dist/lib/output/themes/default/partials/comment.js +2 -3
  60. package/dist/lib/output/themes/default/partials/navigation.js +1 -1
  61. package/dist/lib/output/themes/default/templates/hierarchy.js +1 -1
  62. package/dist/lib/serialization/events.d.ts +2 -3
  63. package/dist/lib/serialization/events.js +2 -4
  64. package/dist/lib/serialization/index.d.ts +1 -1
  65. package/dist/lib/serialization/serializer.d.ts +10 -5
  66. package/dist/lib/serialization/serializer.js +6 -6
  67. package/dist/lib/utils/component.d.ts +4 -18
  68. package/dist/lib/utils/component.js +1 -39
  69. package/dist/lib/utils/events.d.ts +18 -113
  70. package/dist/lib/utils/events.js +33 -374
  71. package/dist/lib/utils/highlighter.js +1 -1
  72. package/dist/lib/utils/index.d.ts +1 -1
  73. package/dist/lib/utils/index.js +1 -2
  74. package/dist/lib/utils/minimalSourceFile.js +1 -1
  75. package/dist/lib/utils/options/declaration.d.ts +0 -1
  76. package/dist/lib/utils/options/options.js +3 -3
  77. package/dist/lib/utils/options/readers/typedoc.js +1 -1
  78. package/dist/lib/utils/options/sources/typedoc.js +1 -4
  79. package/dist/lib/utils/options/tsdoc-defaults.d.ts +3 -3
  80. package/dist/lib/utils/options/tsdoc-defaults.js +11 -12
  81. package/package.json +7 -6
  82. package/tsdoc.json +9 -1
  83. package/dist/lib/output/themes/default/partials/analytics.d.ts +0 -3
  84. package/dist/lib/output/themes/default/partials/analytics.js +0 -19
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultThemeRenderContext = void 0;
4
4
  const default_1 = require("./layouts/default");
5
5
  const partials_1 = require("./partials");
6
- const analytics_1 = require("./partials/analytics");
7
6
  const breadcrumb_1 = require("./partials/breadcrumb");
8
7
  const comment_1 = require("./partials/comment");
9
8
  const footer_1 = require("./partials/footer");
@@ -71,7 +70,6 @@ class DefaultThemeRenderContext {
71
70
  * by their type declaration, which is already rendered by {@link DefaultThemeRenderContext.memberDeclaration}
72
71
  */
73
72
  this.reflectionPreview = bind(reflectionPreview_1.reflectionPreview, this);
74
- this.analytics = bind(analytics_1.analytics, this);
75
73
  this.breadcrumb = bind(breadcrumb_1.breadcrumb, this);
76
74
  this.commentSummary = bind(comment_1.commentSummary, this);
77
75
  this.commentTags = bind(comment_1.commentTags, this);
@@ -45,6 +45,5 @@ const defaultLayout = (context, template, props) => (utils_1.JSX.createElement("
45
45
  context.hook("sidebar.end", context)))),
46
46
  context.footer(),
47
47
  utils_1.JSX.createElement("div", { class: "overlay" }),
48
- context.analytics(),
49
48
  context.hook("body.end", context))));
50
49
  exports.defaultLayout = defaultLayout;
@@ -6,6 +6,7 @@ exports.reflectionFlags = reflectionFlags;
6
6
  const utils_1 = require("../../../../utils");
7
7
  const models_1 = require("../../../../models");
8
8
  const anchor_icon_1 = require("./anchor-icon");
9
+ const lib_1 = require("../../lib");
9
10
  // Note: Comment modifiers are handled in `renderFlags`
10
11
  function commentSummary({ markdown }, props) {
11
12
  if (!props.comment?.summary.some((part) => part.text))
@@ -47,7 +48,5 @@ function reflectionFlags(context, props) {
47
48
  }
48
49
  }
49
50
  }
50
- return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null, allFlags.map((item) => (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
51
- utils_1.JSX.createElement("code", { class: "tsd-tag ts-flag" + item }, item),
52
- " ")))));
51
+ return (0, lib_1.join)(" ", allFlags, (item) => utils_1.JSX.createElement("code", { class: "tsd-tag" }, item));
53
52
  }
@@ -78,7 +78,7 @@ const navigation = function navigation(context, props) {
78
78
  context.icons[models_1.ReflectionKind.Project](),
79
79
  utils_1.JSX.createElement("span", null, (0, lib_1.getDisplayName)(props.project))),
80
80
  utils_1.JSX.createElement("ul", { class: "tsd-small-nested-navigation", id: "tsd-nav-container", "data-base": context.relativeURL("./") },
81
- utils_1.JSX.createElement("li", null, "Loading..."))));
81
+ utils_1.JSX.createElement("li", null, context.i18n.theme_loading()))));
82
82
  };
83
83
  exports.navigation = navigation;
84
84
  function pageSidebar(context, props) {
@@ -25,6 +25,6 @@ function fullHierarchy(context, root, seen = new Set()) {
25
25
  }
26
26
  function hierarchyTemplate(context, props) {
27
27
  return (utils_1.JSX.createElement(utils_1.JSX.Fragment, null,
28
- utils_1.JSX.createElement("h2", null, "Class Hierarchy"),
28
+ utils_1.JSX.createElement("h2", null, context.i18n.theme_class_hierarchy_title()),
29
29
  (0, lib_1.getHierarchyRoots)(props.project).map((root) => (utils_1.JSX.createElement("ul", { class: "tsd-full-hierarchy" }, fullHierarchy(context, root))))));
30
30
  }
@@ -1,4 +1,3 @@
1
- import { Event } from "../utils/events";
2
1
  import type { ProjectReflection } from "../models";
3
2
  import type { ProjectReflection as JSONProjectReflection } from "./schema";
4
3
  /**
@@ -8,11 +7,11 @@ import type { ProjectReflection as JSONProjectReflection } from "./schema";
8
7
  * @see {@link Serializer.EVENT_BEGIN}
9
8
  * @see {@link Serializer.EVENT_END}
10
9
  */
11
- export declare class SerializeEvent extends Event {
10
+ export declare class SerializeEvent {
12
11
  /**
13
12
  * The project the renderer is currently processing.
14
13
  */
15
14
  readonly project: ProjectReflection;
16
15
  output: JSONProjectReflection | undefined;
17
- constructor(name: string, project: ProjectReflection, output?: JSONProjectReflection);
16
+ constructor(project: ProjectReflection, output?: JSONProjectReflection);
18
17
  }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SerializeEvent = void 0;
4
- const events_1 = require("../utils/events");
5
4
  /**
6
5
  * An event emitted by the {@link Serializer} class at the very beginning and
7
6
  * ending of the a project serialization process.
@@ -9,9 +8,8 @@ const events_1 = require("../utils/events");
9
8
  * @see {@link Serializer.EVENT_BEGIN}
10
9
  * @see {@link Serializer.EVENT_END}
11
10
  */
12
- class SerializeEvent extends events_1.Event {
13
- constructor(name, project, output) {
14
- super(name);
11
+ class SerializeEvent {
12
+ constructor(project, output) {
15
13
  this.project = project;
16
14
  this.output = output;
17
15
  }
@@ -2,4 +2,4 @@ export type { SerializerComponent } from "./components";
2
2
  export { Deserializer, type Deserializable, type DeserializerComponent, } from "./deserializer";
3
3
  export { SerializeEvent } from "./events";
4
4
  export * as JSONOutput from "./schema";
5
- export { Serializer } from "./serializer";
5
+ export { Serializer, type SerializerEvents } from "./serializer";
@@ -1,18 +1,23 @@
1
1
  import { EventDispatcher } from "../utils";
2
2
  import type { ProjectReflection } from "../models";
3
+ import { SerializeEvent } from "./events";
3
4
  import type { ModelToObject } from "./schema";
4
5
  import type { SerializerComponent } from "./components";
5
- export declare class Serializer extends EventDispatcher {
6
+ export interface SerializerEvents {
7
+ begin: [SerializeEvent];
8
+ end: [SerializeEvent];
9
+ }
10
+ export declare class Serializer extends EventDispatcher<SerializerEvents> {
6
11
  /**
7
12
  * Triggered when the {@link Serializer} begins transforming a project.
8
- * @event EVENT_BEGIN
13
+ * @event
9
14
  */
10
- static EVENT_BEGIN: string;
15
+ static readonly EVENT_BEGIN = "begin";
11
16
  /**
12
17
  * Triggered when the {@link Serializer} has finished transforming a project.
13
- * @event EVENT_END
18
+ * @event
14
19
  */
15
- static EVENT_END: string;
20
+ static readonly EVENT_END = "end";
16
21
  private serializers;
17
22
  /**
18
23
  * Only set when serializing.
@@ -32,22 +32,22 @@ class Serializer extends utils_1.EventDispatcher {
32
32
  */
33
33
  projectToObject(value, projectRoot) {
34
34
  this.projectRoot = projectRoot;
35
- const eventBegin = new events_1.SerializeEvent(Serializer.EVENT_BEGIN, value);
36
- this.trigger(eventBegin);
35
+ const eventBegin = new events_1.SerializeEvent(value);
36
+ this.trigger(Serializer.EVENT_BEGIN, eventBegin);
37
37
  const project = this.toObject(value);
38
- const eventEnd = new events_1.SerializeEvent(Serializer.EVENT_END, value, project);
39
- this.trigger(eventEnd);
38
+ const eventEnd = new events_1.SerializeEvent(value, project);
39
+ this.trigger(Serializer.EVENT_END, eventEnd);
40
40
  return project;
41
41
  }
42
42
  }
43
43
  exports.Serializer = Serializer;
44
44
  /**
45
45
  * Triggered when the {@link Serializer} begins transforming a project.
46
- * @event EVENT_BEGIN
46
+ * @event
47
47
  */
48
48
  Serializer.EVENT_BEGIN = "begin";
49
49
  /**
50
50
  * Triggered when the {@link Serializer} has finished transforming a project.
51
- * @event EVENT_END
51
+ * @event
52
52
  */
53
53
  Serializer.EVENT_END = "end";
@@ -1,12 +1,12 @@
1
1
  import type { Application } from "../application";
2
- import { EventDispatcher, Event, type EventMap } from "./events";
2
+ import { EventDispatcher } from "./events";
3
3
  /**
4
4
  * Exposes a reference to the root Application component.
5
5
  */
6
6
  export interface ComponentHost {
7
7
  readonly application: Application;
8
8
  }
9
- export interface Component extends AbstractComponent<ComponentHost> {
9
+ export interface Component<E extends Record<keyof E, unknown[]> = {}> extends AbstractComponent<ComponentHost, E> {
10
10
  }
11
11
  export interface ComponentClass<T extends Component, O extends ComponentHost = ComponentHost> extends Function {
12
12
  new (owner: O): T;
@@ -24,20 +24,13 @@ export interface ComponentOptions {
24
24
  * Class decorator applied to Components
25
25
  */
26
26
  export declare function Component(options: ComponentOptions): (target: Function, _context: unknown) => void;
27
- export declare class ComponentEvent extends Event {
28
- owner: ComponentHost;
29
- component: AbstractComponent<ComponentHost>;
30
- static ADDED: string;
31
- static REMOVED: string;
32
- constructor(name: string, owner: ComponentHost, component: AbstractComponent<ComponentHost>);
33
- }
34
27
  /**
35
28
  * Component base class. Has an owner (unless it's the application root component),
36
29
  * can dispatch events to its children, and has access to the root Application component.
37
30
  *
38
31
  * @template O type of component's owner.
39
32
  */
40
- export declare abstract class AbstractComponent<O extends ComponentHost> extends EventDispatcher implements ComponentHost {
33
+ export declare abstract class AbstractComponent<O extends ComponentHost, E extends Record<keyof E, unknown[]>> extends EventDispatcher<E> implements ComponentHost {
41
34
  /**
42
35
  * The owner of this component instance.
43
36
  */
@@ -54,7 +47,6 @@ export declare abstract class AbstractComponent<O extends ComponentHost> extends
54
47
  * Initialize this component.
55
48
  */
56
49
  protected initialize(): void;
57
- protected bubble(name: Event | EventMap | string, ...args: any[]): this;
58
50
  /**
59
51
  * Return the application / root component instance.
60
52
  */
@@ -70,10 +62,7 @@ export declare abstract class AbstractComponent<O extends ComponentHost> extends
70
62
  * @template O type of Component's owner
71
63
  * @template C type of Component's children
72
64
  */
73
- export declare abstract class ChildableComponent<O extends ComponentHost, C extends Component> extends AbstractComponent<O> {
74
- /**
75
- *
76
- */
65
+ export declare abstract class ChildableComponent<O extends ComponentHost, C extends Component, E extends Record<keyof E, unknown[]>> extends AbstractComponent<O, E> {
77
66
  private _componentChildren?;
78
67
  private _defaultComponents?;
79
68
  /**
@@ -87,8 +76,5 @@ export declare abstract class ChildableComponent<O extends ComponentHost, C exte
87
76
  */
88
77
  getComponent(name: string): C | undefined;
89
78
  getComponents(): C[];
90
- hasComponent(name: string): boolean;
91
79
  addComponent<T extends C>(name: string, componentClass: T | ComponentClass<T, O>): T;
92
- removeComponent(name: string): C | undefined;
93
- removeAllComponents(): void;
94
80
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChildableComponent = exports.AbstractComponent = exports.ComponentEvent = void 0;
3
+ exports.ChildableComponent = exports.AbstractComponent = void 0;
4
4
  exports.Component = Component;
5
5
  const events_1 = require("./events");
6
6
  const childMappings = [];
@@ -44,16 +44,6 @@ function Component(options) {
44
44
  }
45
45
  };
46
46
  }
47
- class ComponentEvent extends events_1.Event {
48
- constructor(name, owner, component) {
49
- super(name);
50
- this.owner = owner;
51
- this.component = component;
52
- }
53
- }
54
- exports.ComponentEvent = ComponentEvent;
55
- ComponentEvent.ADDED = "componentAdded";
56
- ComponentEvent.REMOVED = "componentRemoved";
57
47
  /**
58
48
  * Component base class. Has an owner (unless it's the application root component),
59
49
  * can dispatch events to its children, and has access to the root Application component.
@@ -75,14 +65,6 @@ class AbstractComponent extends events_1.EventDispatcher {
75
65
  initialize() {
76
66
  // empty default implementation
77
67
  }
78
- bubble(name, ...args) {
79
- super.trigger(name, ...args);
80
- if (this.owner instanceof AbstractComponent &&
81
- this._componentOwner !== null) {
82
- this.owner.bubble(name, ...args);
83
- }
84
- return this;
85
- }
86
68
  /**
87
69
  * Return the application / root component instance.
88
70
  */
@@ -129,9 +111,6 @@ class ChildableComponent extends AbstractComponent {
129
111
  getComponents() {
130
112
  return Object.values(this._componentChildren || {});
131
113
  }
132
- hasComponent(name) {
133
- return !!(this._componentChildren || {})[name];
134
- }
135
114
  addComponent(name, componentClass) {
136
115
  if (!this._componentChildren) {
137
116
  this._componentChildren = {};
@@ -146,26 +125,9 @@ class ChildableComponent extends AbstractComponent {
146
125
  const component = typeof componentClass === "function"
147
126
  ? new componentClass(this)
148
127
  : componentClass;
149
- const event = new ComponentEvent(ComponentEvent.ADDED, this, component);
150
- this.bubble(event);
151
128
  this._componentChildren[name] = component;
152
129
  return component;
153
130
  }
154
131
  }
155
- removeComponent(name) {
156
- const component = (this._componentChildren || {})[name];
157
- if (component) {
158
- delete this._componentChildren[name];
159
- component.stopListening();
160
- this.bubble(new ComponentEvent(ComponentEvent.REMOVED, this, component));
161
- return component;
162
- }
163
- }
164
- removeAllComponents() {
165
- for (const component of Object.values(this._componentChildren || {})) {
166
- component.stopListening();
167
- }
168
- this._componentChildren = {};
169
- }
170
132
  }
171
133
  exports.ChildableComponent = ChildableComponent;
@@ -1,123 +1,28 @@
1
- export interface EventCallback extends Function {
2
- _callback?: Function;
3
- }
4
- export interface EventMap {
5
- [name: string]: EventCallback;
6
- }
7
1
  /**
8
- * An event object.
9
- */
10
- export declare class Event {
11
- /**
12
- * The name of the event.
13
- */
14
- private _name;
15
- /**
16
- * Has {@link Event.stopPropagation} been called?
17
- */
18
- private _isPropagationStopped;
19
- /**
20
- * Has {@link Event.preventDefault} been called?
21
- */
22
- private _isDefaultPrevented;
23
- /**
24
- * Create a new Event instance.
25
- */
26
- constructor(name: string);
27
- /**
28
- * Stop the propagation of this event. Remaining event handlers will not be executed.
29
- */
30
- stopPropagation(): void;
31
- /**
32
- * Prevent the default action associated with this event from being executed.
33
- */
34
- preventDefault(): void;
35
- /**
36
- * Return the event name.
37
- */
38
- get name(): string;
39
- /**
40
- * Has {@link Event.stopPropagation} been called?
41
- */
42
- get isPropagationStopped(): boolean;
43
- /**
44
- * Has {@link Event.preventDefault} been called?
45
- */
46
- isDefaultPrevented(): boolean;
47
- }
48
- /**
49
- * A class that provides a custom event channel.
2
+ * Intentionally very simple event emitter.
50
3
  *
51
- * You may bind a callback to an event with `on` or remove with `off`;
52
- * `trigger`-ing an event fires all callbacks in succession.
4
+ * @privateRemarks
5
+ * This is essentially a stripped down copy of EventHooks in hooks.ts.
53
6
  */
54
- export declare class EventDispatcher {
55
- /**
56
- * Map of all handlers registered with the "on" function.
57
- */
58
- private _events?;
59
- /**
60
- * Map of all objects this instance is listening to.
61
- */
62
- private _listeningTo?;
63
- /**
64
- * Map of all objects that are listening to this instance.
65
- */
66
- private _listeners?;
67
- /**
68
- * A unique id that identifies this instance.
69
- */
70
- private get _listenId();
71
- private _savedListenId?;
72
- /**
73
- * Bind an event to a `callback` function. Passing `"all"` will bind
74
- * the callback to all events fired.
75
- */
76
- on(eventMap: EventMap, context?: any): this;
77
- on(eventMap: EventMap, callback?: EventCallback, context?: any, priority?: number): this;
78
- on(name: string, callback: EventCallback, context?: any, priority?: number): this;
79
- /**
80
- * Guard the `listening` argument from the public API.
81
- */
82
- private internalOn;
83
- /**
84
- * Bind an event to only be triggered a single time. After the first time
85
- * the callback is invoked, its listener will be removed. If multiple events
86
- * are passed in using the space-separated syntax, the handler will fire
87
- * once for each event, not once for a combination of all events.
88
- */
89
- once(eventMap: EventMap, context?: any): this;
90
- once(name: string, callback: EventCallback, context?: any, priority?: any): this;
91
- /**
92
- * Remove one or many callbacks. If `context` is null, removes all
93
- * callbacks with that function. If `callback` is null, removes all
94
- * callbacks for the event. If `name` is null, removes all bound
95
- * callbacks for all events.
96
- */
97
- off(): this;
98
- off(eventMap: EventMap | undefined, context?: any): this;
99
- off(name: string | undefined, callback?: EventCallback, context?: any): this;
100
- /**
101
- * Inversion-of-control versions of `on`. Tell *this* object to listen to
102
- * an event in another object... keeping track of what it's listening to
103
- * for easier unbinding later.
104
- */
105
- listenTo(obj: EventDispatcher, name: EventMap | string, callback?: EventCallback, priority?: number): this;
7
+ export declare class EventDispatcher<T extends Record<keyof T, unknown[]>> {
8
+ private _listeners;
106
9
  /**
107
- * Inversion-of-control versions of `once`.
10
+ * Starts listening to an event.
11
+ * @param event the event to listen to.
12
+ * @param listener function to be called when an this event is emitted.
13
+ * @param priority optional priority to insert this hook with.
108
14
  */
109
- listenToOnce(obj: EventDispatcher, eventMap: EventMap): this;
110
- listenToOnce(obj: EventDispatcher, name: string, callback: EventCallback, priority?: number): this;
15
+ on<K extends keyof T>(event: K, listener: (this: undefined, ...args: T[K]) => void, priority?: number): void;
111
16
  /**
112
- * Tell this object to stop listening to either specific events ... or
113
- * to every object it's currently listening to.
17
+ * Stops listening to an event.
18
+ * @param event the event to stop listening to.
19
+ * @param listener the function to remove from the listener array.
114
20
  */
115
- stopListening(obj?: EventDispatcher, name?: EventMap | string, callback?: EventCallback): this;
21
+ off<K extends keyof T>(event: K, listener: (this: undefined, ...args: T[K]) => void): void;
116
22
  /**
117
- * Trigger one or many events, firing all bound callbacks. Callbacks are
118
- * passed the same arguments as `trigger` is, apart from the event name
119
- * (unless you're listening on `"all"`, which will cause your callback to
120
- * receive the true name of the event as the first argument).
23
+ * Emits an event to all currently subscribed listeners.
24
+ * @param event the event to emit.
25
+ * @param args any arguments required for the event.
121
26
  */
122
- trigger(name: Event | EventMap | string, ...args: any[]): this;
27
+ trigger<K extends keyof T>(event: K, ...args: T[K]): void;
123
28
  }