-
Notifications
You must be signed in to change notification settings - Fork 0
/
H5P.d.ts
94 lines (85 loc) · 2.22 KB
/
H5P.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* eslint-disable @typescript-eslint/no-explicit-any */
import { H5PWrapper } from "./src/h5p/H5PWrapper";
export interface H5PObject {
EventDispatcher: typeof EventDispatcher;
PytH5P: typeof H5PWrapper;
}
declare class EventDispatcher {
/**
* Add new event listener.
*
* @throws {TypeError}
* listener must be a function
* @param {string} type
* Event type
* @param {H5P.EventCallback} listener
* Event listener
* @param {Object} [thisArg]
* Optionally specify the this value when calling listener.
*/
on: (type: string, listener: any, thisArg?: any) => void;
/**
* Add new event listener that will be fired only once.
*
* @throws {TypeError}
* listener must be a function
* @param {string} type
* Event type
* @param {H5P.EventCallback} listener
* Event listener
* @param {Object} thisArg
* Optionally specify the this value when calling listener.
*/
once: (type: string, listener: any, thisArg: any) => void;
/**
* Remove event listener.
* If no listener is specified, all listeners will be removed.
*
* @throws {TypeError}
* listener must be a function
* @param {string} type
* Event type
* @param {H5P.EventCallback} listener
* Event listener
*/
off: (type: string, listener: any) => void;
/**
* Dispatch event.
*
* @param {string|H5P.Event} event
* Event object or event type as string
* @param {*} [eventData]
* Custom event data(used when event type as string is used as first
* argument).
* @param {Object} [extras]
* @param {boolean} [extras.bubbles]
* @param {boolean} [extras.external]
*/
trigger: (
event: string | any,
eventData?: any,
extras?: {
bubbles?: boolean;
external?: boolean;
},
) => void;
/**
* createXAPIEventTemplate.
*
* @param {string} verb
* Event object or event type as string
* @param {Object} [extras]
*/
createXAPIEventTemplate: (
verb: string,
extras?: any,
) => void;
}
declare interface IH5PWrapper {
attach($wrapper: JQuery<HTMLElement>): void;
}
declare interface IH5PEditorWrapper {
appendTo($wrapper: JQuery<HTMLElement>): void;
validate(): boolean;
remove(): void;
}