Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(api): add specTraversed to API documentation #83

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions docs/js-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Subscribe the callback function to the specified event.

- **eventName**: string
Specify the event using its name.
One of `"mouseOver"`, `"rangeSelect"`, `"click"`, `"rawData"`, `"onNewTrack"`, `"onNewView"`, `"location"`.
One of `"mouseOver"`, `"rangeSelect"`, `"click"`, `"rawData"`, `"onNewTrack"`, `"onNewView"`, `"location"`, `"specResolved"`.

- **callback**: `(msg:string, eventData)=>void`
A function that is subscribed to the specified event.
Expand Down Expand Up @@ -201,6 +201,14 @@ One of `"mouseOver"`, `"rangeSelect"`, `"click"`, `"rawData"`, `"onNewTrack"`, `
}
```

- For `"specResolved"`, the `eventData` stores the spec as processed in the compiler, resolving defaults and attributes inherited from a parent view, as well as flattening overlaid tracks.
```javascript
{
id: string,
spec: GoslingSpec
}
```

## unsubscribe
```javascript
api.unsubscribe(eventName:string)
Expand All @@ -211,4 +219,4 @@ Unsubscribe the callback function from the specified event.

- **eventName**: string
Name of the event.
One of `"mouseOver"`, `"rangeSelect"`, `"click"`, `"rawData"`, `"location"`.
One of `"mouseOver"`, `"rangeSelect"`, `"click"`, `"rawData"`, `"location"`, `"specResolved"`.