matrix-org / matrix-org/matrix-widget-api

mxwidgets is a function, not an object (dist/api.min.js)

Open
#25 2 comments 1 reaction 0 assignees View on GitHub

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`.

![Peek 2020-12-16 18-41](https://user-images.githubusercontent.com/10872136/102386074-e9027f80-3fce-11eb-9852-6466f45b5488.gif)

**Screenshots**
![Screenshot_2020-12-16_18-40-11](https://user-images.githubusercontent.com/10872136/102385489-2e727d00-3fce-11eb-9846-fc2f5d0872c3.png)

**Desktop (please complete the following information):**
- OS: Manjaro Linux
- Browser Firefox Dev
- Version 84b

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.