Embed React improvements (#2782)
* Add off support. Add getApi export. * Add publish command * Add embed-snippet in prod deps * Update README * Update package.json Co-authored-by: Bailey Pumfleet <[email protected]> Co-authored-by: zomars <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
10 files changed
+64
-14
No files matched your search
@@ -369,6 +369,16 @@ export class Cal {
|
||||
this.actionManager.on(action, callback);
|
||||
}
|
||||
|
||||
off({
|
||||
action,
|
||||
callback,
|
||||
}: {
|
||||
action: Parameters<SdkActionManager["on"]>[0];
|
||||
callback: Parameters<SdkActionManager["on"]>[1];
|
||||
}) {
|
||||
this.actionManager.off(action, callback);
|
||||
}
|
||||
|
||||
preload({ calLink }: { calLink: string }) {
|
||||
// eslint-disable-next-line prefer-rest-params
|
||||
validate(arguments[0], {
|
||||
|
||||
@@ -51,6 +51,11 @@ export class SdkActionManager {
|
||||
window.addEventListener(fullName, callback as EventListener);
|
||||
}
|
||||
|
||||
off(name: string, callback: (arg0: CustomEvent<CustomEventDetail>) => void) {
|
||||
const fullName = this.getFullActionName(name);
|
||||
window.removeEventListener(fullName, callback as EventListener);
|
||||
}
|
||||
|
||||
constructor(ns: string | null) {
|
||||
ns = ns || "";
|
||||
this.namespace = ns;
|
||||
|
||||
Reference in new issue
Block a user