-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.ts
39 lines (32 loc) · 875 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import xs, { Stream } from 'xstream';
import { run } from '@cycle/run';
import { ul, li, makeDOMDriver, DOMSource, VNode } from '@cycle/dom';
import { makeSortable } from '../../../src/makeSortable';
type Sources = {
DOM: DOMSource;
};
type Sinks = {
DOM: Stream<VNode>;
};
const main = makeSortable(Child, {
itemSelector: '.li',
selectionDelay: 500
});
function Child({ DOM }: Sources): Sinks {
const vdom$: Stream<VNode> = xs.of(
ul('.ul', [
li('.li', '', ['You have to hold for 500ms to start reordering']),
li('.li', '', ['Option 2']),
li('.li', '', ['Option 3']),
li('.li', '', ['Option 4']),
li('.li', '', ['Option 5']),
li('.li', '', ['Option 6'])
])
);
return {
DOM: vdom$
};
}
run(main as any, {
DOM: makeDOMDriver('#app')
});