BrowsingContextListener.jsm |
The BrowsingContextListener can be used to listen for notifications coming
from browsing contexts that get attached or discarded.
Example:
```
const listener = new BrowsingContextListener();
listener.on("attached", onAttached);
listener.startListening();
const onAttached = (eventName, data = {}) => {
const { browsingContext, why } = data;
...
};
```
@emits message
The BrowsingContextListener emits "attached" and "discarded" events,
with the following object as payload:
- {BrowsingContext} browsingContext
Browsing context the notification relates to.
- {string} why
Usually "attach" or "discard", but will contain "replace" if the
browsing context gets replaced by a cross-group navigation.
|
2542 |
ConsoleAPIListener.jsm |
The ConsoleAPIListener can be used to listen for messages coming from console
API usage in a given windowGlobal, eg. console.log, console.error, ...
Example:
```
const listener = new ConsoleAPIListener(innerWindowId);
listener.on("message", onConsoleAPIMessage);
listener.startListening();
const onConsoleAPIMessage = (eventName, data = {}) => {
const { arguments: msgArguments, level, stacktrace, timeStamp } = data;
...
};
```
@emits message
The ConsoleAPIListener emits "message" events, with the following object as
payload:
- {Array<Object>} arguments - Arguments as passed-in when the method was called.
- {String} level - Importance, one of `info`, `warning`, `error`, `debug`, `trace`.
- {Array<Object>} stacktrace - List of stack frames, starting from most recent.
- {Number} timeStamp - Timestamp when the method was called.
|
3605 |
ConsoleListener.jsm |
The ConsoleListener can be used to listen for console messages related to
Javascript errors, certain warnings which all happen within a specific
windowGlobal. Consumers can listen for the message types "error",
"warning" and "info".
Example:
```
const onJavascriptError = (eventName, data = {}) => {
const { level, message, stacktrace, timestamp } = data;
...
};
const listener = new ConsoleListener(innerWindowId);
listener.on("error", onJavascriptError);
listener.startListening();
...
listener.stopListening();
```
@emits message
The ConsoleListener emits "error", "warning" and "info" events, with the
following object as payload:
- {String} level - Importance, one of `info`, `warning`, `error`,
`debug`, `trace`.
- {String} message - Actual message from the console entry.
- {Array<StackFrame>} stacktrace - List of stack frames,
starting from most recent.
- {Number} timeStamp - Timestamp when the method was called.
|
4474 |
LoadListener.jsm |
The LoadListener can be used to listen for load events.
Example:
```
const listener = new LoadListener();
listener.on("DOMContentLoaded", onDOMContentLoaded);
listener.startListening();
const onDOMContentLoaded = (eventName, data = {}) => {
const { target } = data;
...
};
```
@emits message
The LoadListener emits "DOMContentLoaded" events,
with the following object as payload:
- {Document} target
The target document.
|
1982 |
test |
|
1 |