Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Implementation of MscGen and two derived languages in JavaScript.
This is the JavaScript library that takes care of parsing and rendering MscGen. You might be looking for one of these in stead:
alt
and
loop
.mscgen_js works in anything with an implementation of the document object model (DOM). This includes web-browsers, client-side application shells like electron and even headless browsers like phantomjs. It does not include nodejs (although it is possible to get it sorta to work even there with jsdom).
npm install mscgenjs
You'll have to import the mscgenjs module somehow. There's a commonjs and a
requirejs variant, both of which are in the mscgenjs
npm module
(repo: mscgenjs/mscgenjs-core).
// commonjs
var mscgenjs = require('mscgenjs');
// commonjs, but with lazy loading. Useful when you're using it in
// e.g. an electron shell without a minifier.
var mscgenjs = require('mscgenjs/index-lazy');
// requirejs - assuming the module is in your root and you're loading from
// node_modules.
define(['./node_modules/mscgenjs/index'], function(mscgenjs){
// your code here
});
// ... or using the alternative notation
define(function(require){
var mscgenjs = require("./node_modules/mscgenjs/index");
// your code here
});
Here's some some samples for using the root module directly:
// renders the given script in the (already existing) element with id=yourCoolId
mscgenjs.renderMsc (
'msc { a,b; a=>>b[label="render this"; }',
{
elementId: "yourCoolId"
}
);
If you want to do error handling, or act on the created svg: provide a callback:
mscgenjs.renderMsc (
'msc { a,b; a=>>b[label="render this"; }',
{
elementId: "yourOtherCoolId"
},
handleRenderMscResult
);
function handleRenderMscResult(pError, pSuccess) {
if (Boolean(pError)){
console.log (pError);
return;
} else if (Boolean(pSuccess)){
console.log ('That worked - cool!');
return;
// the svg is in the pSuccess argument
}
console.log('Wat! Error nor success?');
}
The second parameter in the renderMsc
call takes some options that influence rendering e.g.
mscgenjs.renderMsc (
'a=>>b:render this;',
{
elementId: "yourThirdCoolId",
inputType: "msgenny", // language to parse - default "mscgen"; other accepted languages: "xu", "msgenny" and "json"
mirrorEntitiesOnBottom: true, // draws entities on both top and bottom of the chart - default false
additionalTemplate: "lazy", // use a predefined template. E.g. "lazy" or "classic". Default empty
includeSource: false, // whether the generated svg should include the source in a desc element
},
In doc/samples you'll find a simple dynamic integration using webpack and one using requirejs.
You can use the second function of the root module for transpiling to and from msgenny, mscgen, xù and json and for exporting to dot and doxygen. This function does not depend on the DOM so you can use it not only in browsers & browser-likes, but also hack-free in node.
mscgenjs.translateMsc(
'wordwraparcs=on; you =>> me: can we translate this to Mscgen please?; me >> you: "yes, you can - use translateMsc";',
{
inputType: "msgenny", // defaults to mscgen - other accepted formats: msgenny, xu, json
outputType: "mscgen" // defaults to json - other accepted formats: mscgen, msgenny, xu, dot, doxygen
},
function(pError, pSuccess){
if(Boolean(pError)){
console.log("error:", pError);
return;
}
if(Boolean(pSuccess)){
// the transpiled result is in pSuccess
console.log(pSuccess);
return;
}
console.log("Neither success nor failure. I do not even.");
}
);
// result:
//
// msc {
// wordwraparcs=true;
//
// you,
// me;
//
// you =>> me [label="can we translate this to Mscgen please?"];
// me >> you [label="yes, you can - use translateMsc"];
// }
Software that uses mscgenjs
:
See build.md.
You can start reading about that over here
This software is free software licensed under GPLv3. This means (a.o.) you can use it as part of other free software, but not as part of non free software.
We built mscgen_js on various libraries, each of which have their own license (incidentally all MIT style):
It uses istanbul, eslint, plato and nsp to maintain some modicum of verifiable code quality. You can see the build history in Travis and an indication of the shape of the code at Bit Hound.
FAQs
Sequence chart rendering library
We found that mscgenjs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.