EdithProDOCS
SDK v1.0.5 ▾Dashboard
SDK/FRAMEWORKS

Angular, Svelte and more

Any framework can use the core class. Create it once, and destroy it when you’re done.

On this page

Angular #

edithpro.service.ts
import { Injectable, OnDestroy } from '@angular/core';import { EdithPro } from '@edithpro/sdk'; @Injectable({ providedIn: 'root' })export class EdithProService implements OnDestroy {  readonly ep = new EdithPro({    clientId: 'ep_live_abc123',    workspaceId: 'ws_64f2a1b3',  });   constructor() { this.ep.init(); }  open() { this.ep.open(); }  ngOnDestroy() { this.ep.destroy(); }}
record-button.component.ts
@Component({  selector: 'app-record-button',  template: `<button (click)="edithpro.open()">Record a video</button>`,})export class RecordButtonComponent {  constructor(public edithpro: EdithProService) {}}

With server-side rendering, only create the SDK in the browser, for example behind isPlatformBrowser.

Svelte and SvelteKit #

RecordButton.svelte
<script>  import { onMount, onDestroy } from 'svelte';  let ep;   onMount(async () => {    const { EdithPro } = await import('@edithpro/sdk');    ep = new EdithPro({ clientId: 'ep_live_abc123', workspaceId: 'ws_64f2a1b3' });    ep.init();  });  onDestroy(() => ep?.destroy());</script> <button on:click={() => ep?.open()}>Record a video</button>

Web component #

edithpro-button.js
import { EdithPro } from '@edithpro/sdk'; class EdithProButton extends HTMLElement {  connectedCallback() {    this.ep = new EdithPro({      clientId: this.getAttribute('client-id'),      workspaceId: this.getAttribute('workspace-id'),    });    this.ep.init();    this.addEventListener('click', () => this.ep.open());  }  disconnectedCallback() { this.ep.destroy(); }}customElements.define('edithpro-button', EdithProButton);

Then use <edithpro-button client-id="…" workspace-id="…">Record</edithpro-button> in any HTML, including Rails, Django, Laravel or WordPress templates.

Was this page helpful? @edithpro/sdk 1.0.5 · Edit this page