adrai / adrai/flowchart.js

Code in javascript direct?

Offen
#189 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
8.7k
Forks
1.2k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

What a fantastic library! I'm curious, however, if we can code in js directly to achieve the same output. It'd be really nice to not have to learn a new language and get the same output. Here is an example I quickly converted from the README.md:
```js
import {
start,
end,
operation,
subroutine,
condition,
inputoutput,
parallel } from 'flowchart.js';
// st=>start: Start:>http://www.google.com[blank]
const st = start({ title: 'Start', url: 'http://www.google.com', target: 'blank' });
// e=>end:>http://www.google.com
const e = end({ href: 'http://www.google.com' });
// op1=>operation: My Operation
const op1 = operation({ title: 'My Operation' });
// sub1=>subroutine: My Subroutine
const sub1 = subroutine({ title: 'My Subroutine' });
// cond=>condition: Yes
// or No?:>http://www.google.com
const cond = condition({ title: 'Yes\nor No?', url: 'http://www.google.com' });
// io=>inputoutput: catch something...
const io = inputoutput({ title: 'catch something...' });
// para=>parallel: parallel tasks
const para = parallel({ title: 'parallel tasks' });
//
// st->op1->cond
st.link(op1).link(cond);
// cond(yes)->io->e
cond.yes.link(io).link(e);
// cond(no)->para
cond.no.link(para);
// para(path1, bottom)->sub1(right)->op1
para.path1.bottom.link(sub1.right).link(op1);
// para(path2, top)->op1
para.path2.top.link(op1);
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.