Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Apr 09 13:08
    kevinprotoss starred jbeard4/SCION
  • Mar 28 02:44
    snowmoun starred jbeard4/SCION
  • Mar 13 19:07
    developer-mayuan starred jbeard4/SCION-CORE
  • Dec 12 2018 20:24
    dirk-rathje starred jbeard4/SCION
  • Nov 17 2018 17:01
  • Sep 22 2018 02:32
    aheiss1 starred jbeard4/SCION
  • Sep 19 2018 04:53
    carloslfu starred jbeard4/SCION
  • Sep 14 2018 20:31
    pmogren starred jbeard4/SCION
  • Sep 10 2018 23:00

    jbeard4 on master

    Update package versions. Update package version (compare)

  • Sep 10 2018 23:00

    jbeard4 on master

    Update package versions. Update package version (compare)

  • Sep 10 2018 23:00

    jbeard4 on master

    Update package versions. Update package version (compare)

  • Sep 10 2018 23:00

    jbeard4 on master

    Update package versions. Update package version (compare)

  • Sep 10 2018 22:49

    jbeard4 on master

    Update package versions. Update package version (compare)

  • Sep 08 2018 22:42

    jbeard4 on master

    Update package version (compare)

  • Sep 08 2018 22:42

    jbeard4 on master

    Update package version (compare)

  • Sep 08 2018 22:42

    jbeard4 on master

    Update package version (compare)

  • Sep 08 2018 22:42

    jbeard4 on master

    Update package version (compare)

  • Sep 08 2018 22:42

    jbeard4 on master

    Update package version (compare)

  • Sep 06 2018 20:33

    jbeard4 on master

    Removed docs directory (compare)

  • Sep 06 2018 20:33

    jbeard4 on master

    Add a babelrc configuration file (compare)

Jacob Beard
@jbeard4
Unless you are specifically targeting chrome
Jiajun-Deng
@Jiajun-Deng
The vscode says, this module needs a declaration file.
Jacob Beard
@jbeard4
Which support async functions natively
Jiajun-Deng
@Jiajun-Deng
In the babel website, they said: @babel/polyfill isn't a plugin or preset, but a runtime package: if we added an option to switch between core-js@2 and core-js@3, both the package versions would need to be included in your bundle. For this reason, we decided to deprecate it: you now should load core-js for polyfills, and regenerator-runtime/runtime if you are transforming generators:

// before
import "@babel/polyfill";

// after
import "core-js/stable";
import "regenerator-runtime/runtime";

Should I change the syntax?
Jacob Beard
@jbeard4
Yeah, you need regenerator-runtime
Jiajun-Deng
@Jiajun-Deng
Should I write import instead of require?
Jacob Beard
@jbeard4
No, use require
I haven’t made it an es module yet
It is still published as commonjs
Jiajun-Deng
@Jiajun-Deng
OK
Jacob Beard
@jbeard4
The easiest way to integrate it is to just drop in the built version via a script tag
That’s if you don’t care about including it in your build system
Otherwise import it as you would a commonjs module
Jiajun-Deng
@Jiajun-Deng
I'm wrapping things in a js file, not editing html. How should I do then?
import _ from 'lodash'; This is the way I import other liabrary
Jiajun-Deng
@Jiajun-Deng
/**
  • SCXML file to javascript obejct.
  • API: scxml.js <documentToModel>
  • @param {} scxmlDoc: scxml document, './model.xml'. /
    scxmlParser(scxmlDoc){
    scxml.documentToModel(scxmlDoc, (err, model) => {
    if(err) throw err;
    model.prepare((err, fnModel) => {
    if(err) throw err;
    console.log(fnModel);
    });
    });
    }
Is this the correct way?
require('babel-polyfill');
let scxml = require('scxml');
I imported them in the beginning of my controller.js
Seems that the import way is not right.
Jacob Beard
@jbeard4
Yes, use require()
require is used to import commonjs modules
import is used to import es modules
SCION is currently exposed as a commonjs module
Jiajun-Deng
@Jiajun-Deng
Hey Jacob, I tried this example. I think I'm getting close to the target. Two things want to make sure: 1, chrome says only allows one babel-polyfill. Does this mean I should not write require('babel-polyfill') for now if I run in chrome? 2. Error: Platform method dom.serializeToString is not supported. Is there anything module I need?
Jiajun-Deng
@Jiajun-Deng
I know what's the problem: I use a file system path as the input parameter, which means I should use urlToModel instead. Right?
Jiajun-Deng
@Jiajun-Deng
*pathToModel
Jacob Beard
@jbeard4
Regarding 1: Babel-polyfill should only be required once in your codebase. Ideally you should put it in your program’s entry point. If you are seeing this error, it might mean babel-polyfill is being loaded elsewhere in your code
Doesn’t have to do with chrome
  1. Use pathToModel or urlToModel to load an scxml file from the filesystem
2 ^—
Jiajun-Deng
@Jiajun-Deng
Thank you Jacob! Actually I used documentStringToModel instead and I passed string as input. It works! I'm so excited. I appreciate all the help you offered to me!
Jacob Beard
@jbeard4
Happy to hear it’s working for you
Also, I would appreciate if you could please post the error you saw when you attempted to install the cli tools
Jiajun-Deng
@Jiajun-Deng
Error: EACCES: permission denied, access '/usr/local/lib/node_modules' @jbeard4
Jiajun-Deng
@Jiajun-Deng
I fixed it.
Jiajun-Deng
@Jiajun-Deng
@jbeard4 Hey, I tried the cli tool. It is amazing! How do you export the generated scxml object into the schviz api? I'm very interested in this case. I'd like to implement in my project.
Jacob Beard
@jbeard4
Schviz is published as a react component. You can pass it an scxml string, a url to an scxml file, or the scxml model object returned by the modelfactory function. You can find some usage examples in a react application and vanillajs application by following the links here: https://gitlab.com/scion-scxml/schviz
Jiajun-Deng
@Jiajun-Deng
great! I will take a look. Thanks.
Jiajun-Deng
@Jiajun-Deng
Hey Jacob! Is the CLI tool able to be installed on windows?
Jacob Beard
@jbeard4
I don’t think I ever tested that. Just Linux and OS X. Maybe you could try it and let me know if it works
Jiajun-Deng
@Jiajun-Deng
Not working. One thing is it needs a bunch of dependency packages like babel and so on. The other is the permission issue.
Jacob Beard
@jbeard4
I think Babel works on windows
Permission issues may be related to your node/npm setup
Jiajun-Deng
@Jiajun-Deng
It works! I just installed some dependencies. Thank you so much as always!
Jacob Beard
@jbeard4
That’s great. Glad to hear it is working
Christian1412
@Christian1412
Hi, is there anyone?
Jacob Beard
@jbeard4
@Christian1412 hi, how can I help you?