matrix-org / matrix-org/matrix-widget-api
mxwidgets is a function, not an object (dist/api.min.js)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 95
- Forks
- 24
- Avg merge
- 16h 16m
- Merged PRs (30d)
- 1
Description
**Describe the bug**
I cannot create my WidgetApi using `new mxwidgets.WidgetApi(widgetId);` because `mxwidgets` is a function.
**To Reproduce**
Steps to reproduce the behavior:
1. Copy the [example](https://github.com/matrix-org/matrix-widget-api/tree/master/examples/widget).
2. Change the import of the api ``.
3. Host it on a https endpoint
4. Post this in a room `/addwidget https://localhost:8080/#/?widgetId=$matrix_widget_id&userId=$matrix_user_id` (adapt it to your address)
5. See the error in the JS terminal of your browser.
**Expected behavior**
`mxwidgets` should be an object, containing at least `WidgetApi` and `MatrixCapabilities`.

**Screenshots**

**Desktop (please complete the following information):**
- OS: Manjaro Linux
- Browser Firefox Dev
- Version 84b
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the import and constructor failure described in the example, then inspect dist/api.min.js to trace how the public bundle is exposed. Done means the bundle exposes an object containing at least WidgetApi and MatrixCapabilities, and the example can construct WidgetApi as documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100