Skip to content

Commit 7162104

Browse files
authored
add documentation for ReportHandle readyState and addEventListener (#62)
1 parent d8bddba commit 7162104

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

sdk/va-report-components/documentation/docs/api/ReportHandle.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ When a report element is assigned new attribute values or removed from the DOM,
1313
any `ReportHandles` obtained from that element are invalidated and should be
1414
discarded.
1515

16+
## Properties
17+
18+
### readyState: string
19+
The ready state of the report. When this value changes, a `readyStateChanged` event is fired on the ReportHandle.
20+
21+
This value can be one of the following:
22+
- `"loading"` when the report is still initializing.
23+
- `"contentLoading"` when the report is still loading its content.
24+
- `"complete"` when the report has finished loading.
25+
- `"error"` when the report encountered an error and could not load.
26+
1627
## Methods
1728

1829
### getObjectHandle(objectName: string): Promise\<ObjectHandle>
@@ -146,3 +157,20 @@ Refreshes the data for all of the objects in the report.
146157
### reloadReport(): void
147158

148159
Reloads the report. This updates all report content and data, which resets all filters and parameters to their default values.
160+
161+
### addEventListener(eventType: string, listener: (event: Object) => void)
162+
163+
Adds an event listener to the `ReportHandle` to call the supplied listener when the specified event occurs.
164+
165+
#### Arguments
166+
167+
`eventType` is a string that represents the event type to listen for. These event types are supported:
168+
- `"readyStateChanged"` for listening to changes on the `readyState` property.
169+
170+
`listener` is an event listener callback function. When the event occurs, `listener` is called and passed an event object containing the following properties:
171+
- `type` is a string that matches the event type.
172+
- `target` refers to the ReportHandle that the event occurred on.
173+
174+
### removeEventListener(eventType: string, listener: (event: Object) => void)
175+
176+
Removes the previously registered event listener from the `ReportHandle`.

0 commit comments

Comments
 (0)