我正在嘗試循環祝福,其示例js代碼在其GitHub頁面上提供,但遇到問題。巴別,意外的令牌(15:33)::
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)
});
我相信,這個代碼可以用巴貝爾跑出,但試圖運行:
./node_modules/.bin/babel src -d dest
結果:
13 | }), {
14 | term: makeTermDriver(screen),
15 | exit: exit$ => exit$.forEach(::process.exit)
| ^
16 | });
我是正確的思維巴貝爾可以用來編譯這個代碼?
任何幫助表示讚賞。
.babelrc:
{
"presets": ["es2015"]
}
{
"plugins": ["transform-function-bind"]
}
:: process.exit是接收作爲參數的項目的功能? –