I am experimenting with cycle-blessed, with the example js code provided on its GitHub page, but am experiencing issues.
import { run } from '@cycle/core';
import blessed from 'blessed';
import { makeTermDriver, box } from 'cycle-blessed';
import { Observable as $ } from 'rx';
let screen = blessed.screen({ smartCSR: true, useBCE: true, title:
'Hello, World!' });
let BlueBox = text => box({ border: { type: 'line', fg: 'blue' } },
text);
run(({ term }) => ({
term: $.just(BlueBox('Hello, World!')),
exit: term.on('key C-c')
}), {
term: makeTermDriver(screen),
exit: exit$ => exit$.forEach(::process.exit)
});
I believe that this code can be ran with Babel, but trying to run:
./node_modules/.bin/babel src -d dest
results in:
13 | }), {
14 | term: makeTermDriver(screen),
15 | exit: exit$ => exit$.forEach(::process.exit)
| ^
16 | });
Am I correct in thinking babel can be used to transpile this code?
Any help appreciated.
.babelrc:
{
"presets": ["es2015"]
}
{
"plugins": ["transform-function-bind"]
}
:: is an experimental function syntax which performs function binding and method extraction.
To transpile the code using this operator it you need to install and add a transform-function-bind plugin to your .babelrc file.
First install it from npm:
$ npm install babel-plugin-transform-function-bind
Then change your .babelrc file to this:
{
"presets": ["es2015"],
"plugins": ["transform-function-bind"]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With