Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code in javascript direct? #189

Open
robertleeplummerjr opened this issue Nov 22, 2019 · 4 comments
Open

Code in javascript direct? #189

robertleeplummerjr opened this issue Nov 22, 2019 · 4 comments

Comments

@robertleeplummerjr
Copy link
Contributor

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:

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);
@adrai
Copy link
Owner

adrai commented Nov 22, 2019

feel free to contribute 😉

@hanshou101
Copy link

I did it . But need some unit-test ……

Maybe soon.

@robertleeplummerjr
Copy link
Contributor Author

Code?

@robertleeplummerjr
Copy link
Contributor Author

@hanshou101 don't leave us hangin'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants