Skip to content

Commit 697ea19

Browse files
committed
Define widget driver as an interface
- Adds `IWidgetDriver` interface - Renames `WidgetDriver` to `BaseWidgetDriver` with old name (`WidgetDriver`) supported but deprecated The goal here is to mean that a client that is implementing a driver can more easily see at compile time what is changing between versions. However, this would mean that we need to change the versioning policy as any addition to IWidgetDriver would be a breaking change (so major version bump). Whereas, at the moment we don't do a major version bump because the abstract WidgetDriver class doesn't require the implementing client to implement anything.
1 parent 318dcc7 commit 697ea19

File tree

4 files changed

+182
-86
lines changed

4 files changed

+182
-86
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ SDK to provide an interface for other platforms.
7777
TODO: Improve this
7878

7979
```typescript
80-
const driver = new CustomDriver(); // an implementation of WidgetDriver
80+
const driver = new CustomDriver(); // an implementation of IWidgetDriver
8181
const api = new ClientWidgetApi(widget, iframe, driver);
8282

8383
// The API is automatically started, so we just have to wait for a ready before doing something

Diff for: src/ClientWidgetApi.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import {
3030
getTimelineRoomIDFromCapability,
3131
isTimelineCapability,
3232
} from "./interfaces/Capabilities";
33-
import { IOpenIDUpdate, ISendEventDetails, ISendDelayedEventDetails, WidgetDriver } from "./driver/WidgetDriver";
33+
import { IOpenIDUpdate, ISendEventDetails, ISendDelayedEventDetails, IWidgetDriver } from "./driver/WidgetDriver";
3434
import {
3535
ICapabilitiesActionResponseData,
3636
INotifyCapabilitiesActionRequestData,
@@ -158,12 +158,12 @@ export class ClientWidgetApi extends EventEmitter {
158158
* conditions, a "ready" event will be raised.
159159
* @param {Widget} widget The widget to communicate with.
160160
* @param {HTMLIFrameElement} iframe The iframe the widget is in.
161-
* @param {WidgetDriver} driver The driver for this widget/client.
161+
* @param {IWidgetDriver} driver The driver for this widget/client.
162162
*/
163163
public constructor(
164164
public readonly widget: Widget,
165165
private iframe: HTMLIFrameElement,
166-
private driver: WidgetDriver,
166+
private driver: IWidgetDriver,
167167
) {
168168
super();
169169
if (!iframe?.contentWindow) {

0 commit comments

Comments
 (0)