You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
consttools=awaitlibrary("tools");constres=awaittools.toTitleCase(["hello from r"]);
Or more elegantly, imho :
const{ toTitleCase }=awaitlibrary("tools");constres=awaittoTitleCase(["hello from r"]);
As we discussed offline, there might be no good reason for it to be specific to the NodeJS runtime, we could definitely benefit from it being natively integrated to webR, so that we could have it in the browser too:
// target code
<scripttype="module" >import('https://webr.r-wasm.org/latest/webr.mjs').then(async({WebR})=>{constwebR=newWebR();awaitwebR.init();lettools=awaitlibrary("tools");letresult=awaittools.toTitleCase(["hello from r"]);});</script>
Sounds like a great feature! My only additional suggestion would be that, similar to other webR APIs, the library() JS function is made accessible through the instantiated webR object:
constwebR=newWebR();awaitwebR.init();lettools=awaitwebR.library("tools");letresult=awaittools.toTitleCase(["hello from r"]);
Yes, feel free to make an intial PR and we'll go from there.
spidyr
currently supports doing the following:Or more elegantly, imho :
As we discussed offline, there might be no good reason for it to be specific to the NodeJS runtime, we could definitely benefit from it being natively integrated to
webR
, so that we could have it in the browser too:Current code exists at https://github.com/ColinFay/spidyr/blob/main/src/library.js
Happy to work on a PR for integrating this directly into webR
The text was updated successfully, but these errors were encountered: