⚡
WebLN Guide
  • Introduction
    • 👋Welcome
    • â„šī¸What is WebLN
    • 🏅Benefits of WebLN
  • Building Lightning Apps
    • 👨‍đŸ’ģ👨đŸ’ģ Getting Started
    • đŸ’ģWebLN Reference
      • 🆕webln.isEnabled()
      • webln.enable()
      • webln.getInfo()
      • webln.keysend()
      • webln.makeInvoice()
      • webln.sendPayment()
      • 🆕webln.sendPaymentAsync()
      • webln.signMessage()
      • webln.verifyMessage()
      • 🆕webln.request()
      • 🆕webln.lnurl()
      • 🆕webln.on()
      • 🆕webln.off()
      • 🆕webln.getBalance()
      • Error handling
    • đŸ› ī¸Libraries and Tools
    • 🔆Best Practices
  • Ressources
    • ⚡WebLN Providers
    • 🚀Showcases
    • 👩‍đŸĢTutorials
    • 🌐Additional Resources
  • Contribute
    • đŸ—ī¸Working Group & Guidelines
    • 📖Glossary
Powered by GitBook
On this page
Edit on GitHub
  1. Building Lightning Apps
  2. WebLN Reference

webln.enable()

Last updated 1 year ago

To begin interacting with WebLN APIs you'll first need to enable the provider. Calling webln.enable() will prompt the user for permission to use the WebLN capabilities of the browser. After that you are free to call any of the other API methods.

Method

async function enable(): void;

Example

  if(typeof window.webln !== 'undefined' && window.webln.isEnabled) {
    const isEnabled = await window.webln.isEnabled();
    // do something with the value
    console.log(isEnabled)
    
  }

Demo

đŸ’ģ