https://github.com/ryota-ka/cycle-ink-driver
Ink driver for Cycle.js
https://github.com/ryota-ka/cycle-ink-driver
cyclejs ink
Last synced: about 1 year ago
JSON representation
Ink driver for Cycle.js
- Host: GitHub
- URL: https://github.com/ryota-ka/cycle-ink-driver
- Owner: ryota-ka
- Created: 2019-05-11T11:33:42.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-10-10T16:59:13.000Z (over 1 year ago)
- Last Synced: 2025-03-28T20:12:05.848Z (over 1 year ago)
- Topics: cyclejs, ink
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/cycle-ink-driver
- Size: 86.9 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cycle-ink-driver
[](https://www.npmjs.com/package/cycle-ink-driver) [](https://circleci.com/gh/ryota-ka/cycle-ink-driver/tree/master)
[Ink](https://github.com/vadimdemedes/ink) driver for [Cycle.js](https://cycle.js.org/)
## Example
```typescript
/** @jsx createIncorporatedElement */
import { ReactSource } from '@cycle/react';
import { run } from '@cycle/run';
import { createIncorporatedElement, makeInkDriver } from 'cycle-ink-driver';
import { Box } from 'ink';
import TextInput from 'ink-text-input';
import { Stream } from 'xstream';
const sels = {
name: Symbol('name'),
};
function View({ name }: { name: string }): JSX.Element {
return (
Name: {}} />
{'-'.repeat(20)}
Hello {name}
);
}
function main({ react }: { react: ReactSource }): { react: Stream } {
const name$ = react.select(sels.name).events('change').startWith('');
const view$ = name$.map((name) => View({ name }));
return {
react: view$,
};
}
const drivers = {
react: makeInkDriver(),
};
run(main, drivers);
```
