npm.io
0.3.38 • Published 3 years ago

@remixproject/plugin-webview

Licence
Version
0.3.38
Deps
4
Size
19 kB
Vulns
23
Weekly
0
Stars
188

Plugin Webview

This library provides connectors to connect a plugin to an engine that can load webview or iframes.

npm install @remixproject/plugin-webview

If you do not expose any API you can create an instance like this :

import { createClient } from '@remixproject/plugin-webview'

const client = createClient()
client.onload(async () => {
  const data = client.call('filemanager', 'readFile', 'ballot.sol')
})

If you need to expose an API to other plugin you need to extends the class:

import { createClient } from '@remixproject/plugin-webview'
import { PluginClient } from '@remixproject/plugin'

class MyPlugin extends PluginClient {
  methods = ['hello']
  hello() {
    console.log('Hello World')
  }
}
const client = createClient()
client.onload(async () => {
  const data = client.call('filemanager', 'readFile', 'ballot.sol')
})