@reef-defi/extension-inject
TypeScript icon, indicating that this package has built-in type declarations

1.0.22 • Public • Published

@reef-defi/extension-inject

This is a basic extension injector that manages access to the global objects available. As an extension developer, you don't need to manage access to the window object manually, by just calling enable here, the global object is setup and managed properly. From here any dapp can access it with the @reef-defi/extension-dapp package;

Usage

import { injectExtension } from '@reef-defi/extension-inject';

// this is the function that will be exposed to be callable by the dapp. It resolves a promise
// with the injected interface, (see `Injected`) when the dapp at `originName` (url) is allowed
// to access functionality
function enableFn (originName: string): Promise<Injected> {
  ...
}

// injects the extension into the page
injectExtension(enableFn, { name: 'myExtension', version: '1.0.1' });

Readme

Keywords

none

Package Sidebar

Install

npm i @reef-defi/extension-inject

Weekly Downloads

3

Version

1.0.22

License

Apache-2

Unpacked Size

24 kB

Total Files

15

Last publish

Collaborators

  • matjazonline
  • frenki
  • jbargu_reef