@portkey/extension-provider
v2.3.5-alpha.5
Published
<p align="center"> <a href="https://portkeydocs.readthedocs.io/en/pre-release/PortkeyDIDSDK/index.html"> <img width="200" src= "https://raw.githubusercontent.com/Portkey-Wallet/portkey-web/master/logo.png"/> </a> </p> <h1 align="center">@portkey/m
Downloads
1,388
Maintainers
Keywords
Readme
This project creates javascript code that will be injected into Portkey APP's WebView environment, for providing basic functions for DApp developers.
Usage
1. Use @portkey/detect-provider
We recommend to use the @portkey/detect-provider package to detect if Portkey is injected.
Click the link above to learn more.
2. Detect provider by your own code (not recommended)
provider will be injected to the window
or globalThis.window
object, providing you a way to detect it directly.
Also, when provider is injected, an event named portkeyInitEvent
will be triggered on the host object (window
).
const detectedProvider:IProvider = window.portkey;
if(!detectedProvider){
// Portkey is not injected yet
window.addEventListener('portkeyInitEvent', ()=>{
const provider = window.portkey;
// Do something with the provider
...
});
}
You can find more details and examples in @portkey/detect-provider 's README doc.