lnsocket

A minimal C library for connecting to the lightning network
git clone git://jb55.com/lnsocket
Log | Files | Refs | Submodules | README | LICENSE

index.js (404B)


      1 
      2 const is_browser = new Function("try {return this===window;}catch(e){ return false;}");
      3 
      4 let Module
      5 if (is_browser()) {
      6 	Module = require("./dist/js/lnsocket.js")
      7 } else {
      8 	Module = require("./dist/node/lnsocket.js")
      9 }
     10 
     11 const LNSocketReady = Module.lnsocket_init()
     12 
     13 async function load_lnsocket(opts)
     14 {
     15 	const LNSocket = await LNSocketReady
     16 	return new LNSocket(opts)
     17 }
     18 
     19 module.exports = load_lnsocket
     20