JoelOtter / kajero

Interactive JavaScript notebooks with clever graphing
Other
1.87k stars 110 forks source link

Allow usage of third-party libraries #43

Open xgrommx opened 8 years ago

xgrommx commented 8 years ago

Hello @JoelOtter How can use smth like lodash or Rxjs? Also how about show result of async operators, for example:

setTimeout(() => somePrintFn(10), 4000);
JoelOtter commented 8 years ago

You can use third party libraries by saving as an HTML page and then adding the <script> tags to the header in the usual way. Including them directly from the editor is something I plan to look into - roughly similar to issue #39, though it'll be loading libraries rather than transpilers.

Regarding async code - you currently can't get that return value. I'll look into resolving returned Promises. I'll make a new issue to track that, and keep this one for tracking the 3rd party libraries. Thanks!

JoelOtter commented 8 years ago

@xgrommx Issue for async code is #44 if you want to subscribe to it.

xgrommx commented 8 years ago

@JoelOtter Looks like u have some changes for async. But it works only for Promise. It isn't good idea to use resolver of Promise. I would like to use smth:

setTimeout(() => print(10), 2000);

It give ability to use all async operations.

JoelOtter commented 8 years ago

This is the wrong place to discuss async, please do so on #44.

I see no issue with using Promises. The code you provide can easily be wrapped in a Promise, as demonstrated now on the Kajero homepage, as well as in #44.

If you need a primer on how to use Promises, I found this guide to be helpful.

xgrommx commented 8 years ago

@JoelOtter hm, what about rxjs?

obs.map(x => x * x).fitter(x => x % 2 === 0).subscribe(x => ?)