hypothesis / hypothesis/client
As a Developer I want to be able to interact with an exposed public API for the client.
- Dominant language
- Mustache
- Stars
- 730
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
## Feature Request Form
### Problem you are trying to address with this feature
The ability to implement functionality within an external web application to interact with the Hypothesis client application.
A few examples of desired functionality:
1. Trigger a new annotation at a specified DOM range.
2. Destroy the client application removing all added DOM elements, events, etc.
3. Trigger the sidebar to toggle / open and close.
4. Disable the ability to close the sidebar. (patmigliaccio/client@383b979)
5. Ability to listen on / build hooks into *more* events; beyond those currently baked into the `hypothesisConfig`. (e.g. 'sidebar-open', 'selection-highlighted', etc.)
*Edit: I am maintaining this as a public log of functionality that I find to be desirable for the use case in which my organization is implementing the Hypothesis client.*
### Your solution
Creation of a `hypothesis` global object, containing exposed methods and properties that abstract the previously listed functionality from the underlying implementation. Also, rolling the `hypothesisConfig` global into this parent object as well.
e.g.
```javascript
window.hypothesis.newAnnotation(Range?);
// window.hypothesis.trigger('newAnnotation', Range?);
window.hypothesis.destroy();
// window.hypothesis.trigger('destroy');
window.hypothesis.toggleSidebar();
// window.hypothesis.trigger('toggleSidebar');
window.hypothesis.config['alwaysOpen'] = true;
window.hypothesis.on('sidebarOpen', e => { /** Act on event. */ });
```
### Add tags - did you add labels?
If this a customer requested feature, make sure to add that label.
**As a non-contributor, I'm unfortunately unable to add labels to this issue.**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.