Angular

Add the script to index.html, then initialize in a component lifecycle hook:

<!-- src/index.html -->
<script src="<https://glyph-core.s3.us-east-1.amazonaws.com/test/Glyph-unified-bundle.js>"></script>
// app.component.ts
import { Component, AfterViewInit, OnDestroy } from "@angular/core";

@Component({
  selector: "app-root",
  template: "<router-outlet></router-outlet>",
})
export class AppComponent implements AfterViewInit, OnDestroy {
  async ngAfterViewInit(): Promise<void> {
    await (window as any).Glyph?.initWidget({
      theme: {
        primaryColor: "#007bff",
        placement: "bottom-right",
        theme: "light",
      },
      supportedChains: ["ethereum"],
    });
  }

  ngOnDestroy(): void {
    (window as any).Glyph?.destroyReactIframe?.();
  }
}

Last updated