Socket
Book a DemoInstallSign in
Socket

awaitnostr

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awaitnostr

awaitnostr

0.0.7
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

awaitnostr

awaitnostr

Documentation

GitHub license npm npm Github Stars

Introduction

awaitnostr is a utility function that allows you to wait for window.nostr to be defined before using window.nostr functions. This can be useful when using the Nostr browser extension API in your web app, as window.nostr may not be defined immediately upon page load.

Import from CDN

To import the awaitnostr module from a CDN, add the following line to your HTML file:

import awaitNostr from 'https://cdn.skypack.dev/awaitnostr'

Usage

To use awaitnostr, simply import the awaitNostr() function from the package:

import awaitNostr from 'awaitnostr'

Then call the awaitNostr() function before using any window.nostr functions:

async function myFunction() {
  await awaitNostr();
  const publicKey = await window.nostr.getPublicKey();
  // Do something with publicKey
}

Demo

You can view the demo by clicking here.

Browser Performance Benchmarks

Below are the performance benchmarks for different web browsers:

Firefox

Elapsed Time (s)Interval Time (s)
22
53

Chrome

Elapsed Time (s)Interval Time (s)
22

Brave

Elapsed Time (s)Interval Time (s)
22
53
9.54.5
16.256.75

License

  • MIT

Keywords

nostr

FAQs

Package last updated on 21 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.