|
1 | 1 | # List of events emitted by a collector
|
2 | 2 |
|
3 |
| -`collector`s communicate via events. The following is a list of all the events |
4 |
| -commont to all `collector`s, with their signature and the `interface` they implement. |
| 3 | +`collector`s communicate via events. The following is a list of all |
| 4 | +the events commont to all `collector`s, with their signature and the |
| 5 | +`interface` they implement. |
| 6 | + |
5 | 7 |
|
6 | 8 | ## `targetfetch::start`
|
7 | 9 |
|
8 |
| -* **When?** When the `collector` is about to start the request to fetch the `target`. |
| 10 | +* **When?** When the `collector` is about to start the request to |
| 11 | + fetch the `target`. |
| 12 | + |
9 | 13 | * **Format**
|
10 |
| -```typescript |
11 |
| -export interface IFetchStartEvent { |
12 |
| - /** The url to download */ |
13 |
| - resource: string; |
14 |
| -} |
15 |
| -``` |
| 14 | + |
| 15 | + ```typescript |
| 16 | + export interface IFetchStartEvent { |
| 17 | + /** The URL to download */ |
| 18 | + resource: string; |
| 19 | + } |
| 20 | + ``` |
| 21 | + |
16 | 22 | * **Remarks:** The event is the same for [`fetch::start`](#fetch::start)
|
17 | 23 |
|
| 24 | + |
18 | 25 | ## `targetfetch::end`
|
19 | 26 |
|
20 |
| -* **When?** When the `collector` has finished downloading the `html` of the `target`. |
| 27 | +* **When?** When the `collector` has finished downloading the `target`. |
| 28 | + |
21 | 29 | * **Format**
|
22 |
| -```typescript |
23 |
| -export interface IFetchEndEvent { |
24 |
| - /** The element that initiated the request. */ |
25 |
| - element: IAsyncHTMLElement; |
26 |
| - /** The url of the target. */ |
27 |
| - resource: string; |
28 |
| - /** The request made to fetch the target. */ |
29 |
| - request: IRequest; |
30 |
| - /** The response sent while fetching the target. */ |
31 |
| - response: IResponse; |
32 |
| -} |
33 |
| -``` |
34 |
| -* **Remarks:** The event is the same for [`fetch::end`](#fetch::end). In this case `element` will be null. |
| 30 | + |
| 31 | + ```typescript |
| 32 | + export interface IFetchEndEvent { |
| 33 | + /** The element that initiated the request. */ |
| 34 | + element: IAsyncHTMLElement; |
| 35 | + /** The URL of the target. */ |
| 36 | + resource: string; |
| 37 | + /** The request made to fetch the target. */ |
| 38 | + request: IRequest; |
| 39 | + /** The response sent while fetching the target. */ |
| 40 | + response: IResponse; |
| 41 | + } |
| 42 | + ``` |
| 43 | + |
| 44 | +* **Remarks:** The event is the same for [`fetch::end`](#fetch::end). |
| 45 | + In this case `element` will be null. |
| 46 | + |
35 | 47 |
|
36 | 48 | ## `targetfetch::error`
|
37 | 49 |
|
38 |
| -* **When?** When the `collector` has found a problem downloading the `html` of the `target`. |
| 50 | +* **When?** When the `collector` has found a problem downloading |
| 51 | + the `target`. |
| 52 | + |
39 | 53 | * **Format**
|
40 |
| -```typescript |
41 |
| -export interface IFetchErrorEvent { |
42 |
| - /** The url of the target. */ |
43 |
| - resource: string; |
44 |
| - /** The element that initiated the request. */ |
45 |
| - element: IAsyncHTMLElement; |
46 |
| - /** The error found. */ |
47 |
| - error: any; |
48 |
| -} |
49 |
| -``` |
50 |
| -* **Remarks:** The event is the same for [`fetch::error`](#fetch::error). In this case `element` will be null. |
| 54 | + |
| 55 | + ```typescript |
| 56 | + export interface IFetchErrorEvent { |
| 57 | + /** The URL of the target. */ |
| 58 | + resource: string; |
| 59 | + /** The element that initiated the request. */ |
| 60 | + element: IAsyncHTMLElement; |
| 61 | + /** The error found. */ |
| 62 | + error: any; |
| 63 | + } |
| 64 | + ``` |
| 65 | +* **Remarks:** The event is the same for [`fetch::error`](#fetch::error). |
| 66 | + In this case `element` will be null. |
| 67 | + |
51 | 68 |
|
52 | 69 | ## `fetch::start`
|
53 |
| -* **When?** When the `collector` is about to start the request to fetch the `target`. |
| 70 | + |
| 71 | +* **When?** When the `collector` is about to start the request to |
| 72 | + fetch the `target`. |
| 73 | + |
54 | 74 | * **Format**
|
55 |
| -```typescript |
56 |
| -export interface IFetchStartEvent { |
57 |
| - /** The url to download */ |
58 |
| - resource: string; |
59 |
| -} |
60 |
| -``` |
| 75 | + |
| 76 | + ```typescript |
| 77 | + export interface IFetchStartEvent { |
| 78 | + /** The URL to download */ |
| 79 | + resource: string; |
| 80 | + } |
| 81 | + ``` |
| 82 | + |
61 | 83 | * **Remarks:** The event is the same for [`targetfetch::start`](#targetfetch::start).
|
62 | 84 |
|
| 85 | + |
63 | 86 | ## `fetch::end`
|
64 | 87 |
|
65 |
| -* **When?** When the `collector` has finished downloading the content of a `resource` (`js`, `css`, `image`, etc.). |
| 88 | +* **When?** When the `collector` has finished downloading the content |
| 89 | + of a `resource` (`js`, `css`, `image`, etc.). |
| 90 | + |
66 | 91 | * **Format**
|
67 |
| -```typescript |
68 |
| -export interface IFetchEndEvent { |
69 |
| - /** The element that initiated the request. */ |
70 |
| - element: IAsyncHTMLElement; |
71 |
| - /** The url of the target */ |
72 |
| - resource: string; |
73 |
| - /** The request made to fetch the target. */ |
74 |
| - request: IRequest; |
75 |
| - /** The response sent while fetching the target. */ |
76 |
| - response: IResponse; |
77 |
| -} |
78 |
| -``` |
| 92 | + |
| 93 | + ```typescript |
| 94 | + export interface IFetchEndEvent { |
| 95 | + /** The element that initiated the request. */ |
| 96 | + element: IAsyncHTMLElement; |
| 97 | + /** The URL of the target */ |
| 98 | + resource: string; |
| 99 | + /** The request made to fetch the target. */ |
| 100 | + request: IRequest; |
| 101 | + /** The response sent while fetching the target. */ |
| 102 | + response: IResponse; |
| 103 | + } |
| 104 | + ``` |
| 105 | + |
79 | 106 | * **Remarks:** The event is the same for [`targetfetch::end`](#targetfetch::end).
|
80 | 107 |
|
81 | 108 | ## `fetch::error`
|
82 | 109 |
|
83 |
| -* **When?** When the `collector` has found a problem downloading the content of a `resource`. |
| 110 | +* **When?** When the `collector` has found a problem downloading |
| 111 | + the content of a `resource`. |
| 112 | + |
84 | 113 | * **Format**
|
85 |
| -```typescript |
86 |
| -export interface IFetchErrorEvent { |
87 |
| - /** The url of the target. */ |
88 |
| - resource: string; |
89 |
| - /** The element that initiated the request. */ |
90 |
| - element: IAsyncHTMLElement; |
91 |
| - /** The error found. */ |
92 |
| - error: any; |
93 |
| -} |
94 |
| -``` |
| 114 | + |
| 115 | + ```typescript |
| 116 | + export interface IFetchErrorEvent { |
| 117 | + /** The URL of the target. */ |
| 118 | + resource: string; |
| 119 | + /** The element that initiated the request. */ |
| 120 | + element: IAsyncHTMLElement; |
| 121 | + /** The error found. */ |
| 122 | + error: any; |
| 123 | + } |
| 124 | + ``` |
| 125 | + |
95 | 126 | * **Remarks:** The event is the same for [`targetfetch::error`](#targetfetch::error).
|
96 | 127 |
|
| 128 | + |
97 | 129 | ## `traverse::start`
|
98 | 130 |
|
99 | 131 | * **When?** When the `collector` is going to start traversing the DOM.
|
| 132 | + |
100 | 133 | * **Format**
|
101 |
| -```typescript |
102 |
| -export interface ITraverseStartEvent { |
103 |
| - /** The url of the target. */ |
104 |
| - resource: string; |
105 |
| -} |
106 |
| -``` |
| 134 | + |
| 135 | + ```typescript |
| 136 | + export interface ITraverseStartEvent { |
| 137 | + /** The URL of the target. */ |
| 138 | + resource: string; |
| 139 | + } |
| 140 | + ``` |
| 141 | + |
107 | 142 |
|
108 | 143 | ## `traverse::end`
|
109 | 144 |
|
110 | 145 | * **When?** When the `collector` has finished traversing the DOM entirely.
|
| 146 | + |
111 | 147 | * **Format**
|
112 |
| -```typescript |
113 |
| -export interface ITraverseEndEvent { |
114 |
| - /** The url of the target. */ |
115 |
| - resource: string; |
116 |
| -} |
117 |
| -``` |
| 148 | + |
| 149 | + ```typescript |
| 150 | + export interface ITraverseEndEvent { |
| 151 | + /** The URL of the target. */ |
| 152 | + resource: string; |
| 153 | + } |
| 154 | + ``` |
| 155 | + |
118 | 156 |
|
119 | 157 | ## `traverse::down`
|
120 | 158 |
|
121 |
| -* **When?** When the `collector` is traversing and starts visiting the children |
122 |
| -of a node. |
| 159 | +* **When?** When the `collector` is traversing and starts visiting |
| 160 | + the children of a node. |
| 161 | + |
123 | 162 | * **Format**
|
124 |
| -```typescript |
125 |
| -export interface ITraverseDownEvent { |
126 |
| - /** The url of the target. */ |
127 |
| - resource: string; |
128 |
| -} |
129 |
| -``` |
| 163 | + |
| 164 | + ```typescript |
| 165 | + export interface ITraverseDownEvent { |
| 166 | + /** The URL of the target. */ |
| 167 | + resource: string; |
| 168 | + } |
| 169 | + ``` |
130 | 170 |
|
131 | 171 | ## `traverse::up`
|
132 | 172 |
|
133 |
| -* **When?** When the `collector` has finsihed visting the children of a node and goes to the next one. |
| 173 | +* **When?** When the `collector` has finsihed visting the children |
| 174 | + of a node and goes to the next one. |
134 | 175 |
|
135 | 176 | * **Format**
|
136 |
| -```typescript |
137 |
| -export interface ITraverseUpEvent { |
138 |
| - /** The url of the target. */ |
139 |
| - resource: string; |
140 |
| -} |
141 |
| -``` |
142 | 177 |
|
143 |
| -## `element::typeofelement` |
| 178 | + ```typescript |
| 179 | + export interface ITraverseUpEvent { |
| 180 | + /** The URL of the target. */ |
| 181 | + resource: string; |
| 182 | + } |
| 183 | + ``` |
144 | 184 |
|
145 |
| -* **When?** When the `collector` visits an element in the DOM when traversing it. `XXXX` is the `nodeType` lower cased. |
| 185 | +## `element::<element-type>` |
| 186 | + |
| 187 | +* **When?** When the `collector` visits an element in the DOM when |
| 188 | + traversing it. `<element-type>` is the [`nodeName`](https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeName) |
| 189 | + lower cased. |
146 | 190 |
|
147 | 191 | * **Format**
|
148 |
| -```typescript |
149 |
| -export interface IElementFoundEvent { |
150 |
| - /** The uri of the resource firing this event. */ |
151 |
| - resource: string; |
152 |
| - /** The visited element. */ |
153 |
| - element: IAsyncHTMLElement; |
154 |
| -} |
155 |
| -``` |
| 192 | + |
| 193 | + ```typescript |
| 194 | + export interface IElementFoundEvent { |
| 195 | + /** The URI of the resource firing this event. */ |
| 196 | + resource: string; |
| 197 | + /** The visited element. */ |
| 198 | + element: IAsyncHTMLElement; |
| 199 | + } |
| 200 | + ``` |
0 commit comments