twister-lib-js

43 views
Skip to first unread message

Julian Steinwachs

unread,
May 3, 2015, 10:04:22 AM5/3/15
to twist...@googlegroups.com
Hey,

The twister javascript library that i've been working on over the last
few weeks has now reached a state where it is worth checking out. I do
not expect huge chances anymore to the functions that are exposed
externally, so feel free to use the library in any project and let me
know if you find bugs. The examples (in the /examples subdirectory) are
written in the form of a tutorial to get familiar with the concepts of
the library. If you want to help developing twister-lib-js please dive
into the code and ask any stupid question you can think of in the
github-issues. Pull-requests are always welcome, of course.

Link to the project: http://github.com/Tschaul/twister-lib-js

Greetings

Tschaul

W-M Wijnja

unread,
May 18, 2015, 8:19:00 PM5/18/15
to twist...@googlegroups.com
I really want to give you kudos for the clear way in which the examples are structured. Thank you very much for this great library!

Op zondag 3 mei 2015 16:04:22 UTC+2 schreef julian.steinwachs:

JM

unread,
Aug 19, 2016, 10:05:24 AM8/19/16
to twister-dev
Hi,
One question on twister-lib-js - it appears to me that it is using node.js functions in there ( e.g. things like:  return querystring.unescape(item)  ) which makes using it on many browsers and VMs problematic.  Am I just missing something?

Julian Steinwachs

unread,
Aug 20, 2016, 4:41:33 AM8/20/16
to twist...@googlegroups.com

Hi,

browserify is used, or rather can be used for bundeling (http://browserify.org/) which comes with browser compatible modules for the node.js own stuff. Some of them however sometimes show strange behavior. That is why for example for the http-requests the twister-lib-js uses jquery if present and falls back to node.js own module if not (https://github.com/Tschaul/twister-lib-js/blob/master/src/TwisterResource.js#L212). The browserified bundle still works without jquery but e.g. CORS (https://de.wikipedia.org/wiki/Cross-Origin_Resource_Sharing) does not work. So twister-lib-js is "isomorphic": it runs in node.js the same way as in browsers.

Greetings

Tschaul
--
You received this message because you are subscribed to the Google Groups "twister-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to twister-dev...@googlegroups.com.
To post to this group, send email to twist...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

JM

unread,
Aug 21, 2016, 7:24:44 PM8/21/16
to twister-dev, julian.s...@fau.de, julian.s...@mail.de
I see. I appreciate the response.  I am going to check it out more.

JM

unread,
Sep 5, 2016, 9:45:20 PM9/5/16
to twister-dev
Hi,
I am still going through the code and I hope you don't mind some additional questions.

If I wanted to use twister-lib.js in my code (vs twister-lib-js in a node project), you need to do more than this:

Download the twister-lib.js file into you project folder. Link to it inside html using
<script src="path/to/twister-lib.js"></script>   
[from here:  https://github.com/Tschaul/twister-lib-js ]

I'm just going through the dependencies and trying to make sure I understand how it all works together.  It would also need the bencode, bitcoinjs-lib, buffer, crypto, inherits, and request dependencies in the same directory.  (Obviously under Node, they are in the node_modules directory.)

I am just trying to understand the differences in usage between the node project vs the standalone.

Thanks!

JM

unread,
Sep 5, 2016, 9:47:09 PM9/5/16
to twister-dev
p.s.  And the first 5-6 examples from the examples folder seem to be working fine (haven't gotten to the rest yet), but they rely on "src/*" vs twister-lib.js

JM

unread,
Sep 5, 2016, 9:56:20 PM9/5/16
to twister-dev
p.p.s.  What I am trying to do is to recreate the examples (even just just using twister-lib.js and its dependencies without relying on Node to make sure I am understanding the dependencies and interactions correctly so that if I wanted to code without running under Node, I could do so.

JM

unread,
Sep 5, 2016, 11:03:46 PM9/5/16
to twister-dev
ppps.  I guess using browserify as you mentioned above is an option, but perhaps I am missing something in the instructions.
Reply all
Reply to author
Forward
0 new messages