curl.lib.js icon indicating copy to clipboard operation
curl.lib.js copied to clipboard

Can't use this lib in browser

Open avihai-developer opened this issue 7 years ago • 3 comments

After i load dist/curl.min.js to my site i don't have curl object available in my window scope

avihai-developer avatar Apr 01 '18 23:04 avihai-developer

Any updates on this? I'm struggling to get this to work as well. Including the library in my html page as <script src="curl.min.js"></script>, but window.curl is not defined and const Curl = require('curl.min.js') or const Curl = require('curl.lib.js') aren't working either.

jlvandenhout avatar Sep 30 '18 12:09 jlvandenhout

As an alternative, I've created npm friendly wrappers for curl which may be used as so:

npm install curl-transaction-core curl-transaction-webgl2-impl

Then in code:

import curlTransaction from 'curl-transaction-core'
import curlImpl from 'curl-transaction-webgl2-impl'

if(!curlImpl.error) {
    localAttachToTangle = curlTransaction({ curlImpl }).localAttachToTangle
    console.log('Your browser does support WebGL2')
    this.iota.link.api.attachToTangle = localAttachToTangle
} else {
    console.error('Your browser does not support WebGL2')
    this.isWebGL2Supported = false
}

pRizz avatar Oct 04 '18 18:10 pRizz

I have no problem doing the following, based on the current master branch:

<script type="text/javascript" src="./old.curl.min.js"></script>
<script type="text/javascript">
curl.init();
... etc
</script>

maybe this has been fixed in the meantime? try making a new version of curl.min.js, clone this repository and run: npm install npm run build and the new curl.min.js will be in the dist folder

desjob avatar May 08 '19 13:05 desjob