Appening 6 - Rescript NodeJS Environment
MartinPacker 11000094DH Visits (3332)
The current version includes Node.js runtime version 8.6.0. I’m expecting the developer will update the app as new releases of Node become available.
The free version of the app allows you to run lots of Node apps. With an in-app purchase you can, most notably, use additional UI and Share modules. These talk to iOS specifically, so your scripts can interact with the device and other apps. The free app is ad-supported, so that might be another reason to pay a small amount of money to the developer.
What Is Node?
Here’s a short example that implements a simple web server, from a sample included with Rescript:
const http = require('http') let server = http
Without taking you through it line by line, there being many Node tutorials around, I would note the vast majority of this code is a character string full of the HTML that would actually be served.
In almost any environment, you could point your. browser at localhost (or 127.0.0.1) and the HTML would be served.
So far I’ve installed Node on Linux, on my iPhone, my iPad, my MacBook Pro, and my Raspberry Pi. It’s simple to install and lots of modules are available for it.
It’s also worth pointing out that Node can act as a web client, for example using the node-fetch module. It can also handle server-side things like files.
You can also create your own modules and, through Node Package Manager (NPM), distribute them.
Rescript is a very new app at the time of writing, but it shows lots of promise.
The app comprises three panes:
While the examples are a little sparse, there are plenty of examples and tutorials on the web. Plus there is a book “Node.js Up And Running” published by O’Reilly. I have it open side by side on my iPad with Rescript. So, that’s a nice use of Split Screen - a key modern iPad feature.
I didn’t find a way to see the source of the Node libraries included with Rescript. I don’t think this is a problem, however, as you’re supposed to code to the APIs, rather than examining the source code. But if you were intent on contributing to these libraries you might well feel different.
Another thing - available in a full IDE - is code completion based on the Node modules brought in by
So, my experience of Rescript is good, despite the nits I mentioned above.
While I haven’t developed any User-Interface (UI) based apps I’ve run the samples and nosed through the code. Unless you point your browser at localhost you’re not going to see HTML and might well be building scripts that use the UI module. You might also use some of the iOS-specific modules.
One I did try was the iOS share sheet capability - which is only available in the paid version.
I mentioned NPM above. I would like to see some NPM capability, if that’s possible.
The help mentions a number of keyboard shortcuts. If you have an iPad you might not have an external keyboard so these wouldn’t help you. More than 99% of the time I use my iPad with an external keyboard so I appreciate these.
The help also tells me I can invoke a Rescript script from a share sheet in another app. This is nice to see. What I haven’t seen is any support for URL schemes. I’m thinking of x-callback-url in particular. I hope this comes as it would allow Rescript to be invoked from other apps as part of some sophisticated automation.
Another nit is that I didn’t find a way to resize the side panels. Particularly for the help, I would have liked that.
Integration With Other iOS Apps - Via The Share Sheet
As I said, I experimented with the share module.
First, I tried Rescript as a “client” - where a Node script pops up the iOS share sheet. Here is a very simple example:
If you run this very short script it does indeed pop up the share sheet, and the text in the
Now here’s Rescript as a “server” - where a Node script accepts text.
As with most share sheet extensions you have to enable them in the share sheet - but that’s merely flipping a switch.
In Workflow (being reborn as Shortcuts in iOS 12) you nominate a workflow to be usable in the share sheet within the Workflow app - when you edit the workflow. In contrast you nominate Rescript scripts to be usable in the share sheet when you invoke the Rescript extension. But it remembers what you did so it’s a one time setup.
Anyway, when you open the iOS share sheet from another app with some text selected you can pass it to a specific Rescript script. With the
The net of this is that Rescript scripts can participate nicely in workflows involving other apps and the iOS share sheet.
By the way, the clipboard module allows you to read from and write to the clipboard.
Drafts And Rescript
I’m very happy with this app but think, as with all new apps, it could get even better. As to whether to pay for the app, I think think the £3.99 I spent was good value for money - particularly as the modules included with the paid version add significant function. But, if your interest in Node is very light, you might be happy with the free version.
In any case, I hope Matteo (@mttvll on Twitter) keeps developing Rescript. My areas of improvements are, I think nits, and I’m just bowled over to be able to run Node on my iPhone and especially my iPad. And to have the nice “iOS integration” extension modules he’s built.