All versions of this documentation

Integration with TypeScript Download code


If you wish to use Ogma within a TypeScript application, we suggest you adding it as a dependency to your project. This can be done in two ways:

Through npm

If you are developing locally and can access the outside Internet you can also install directly.

npm install --save{CUSTOMER_ID}&versionId={PACKAGE_ID}

If you cannot use npm from external sources, because of company policy, you can always install it via tar.gz.

Using downloaded tar.gz

The same link used for the npm version can be used to download a tar.gz file: just past it into your browser to download the file. Once downloaded it is possible to tell npm to use it to install locally:

npm install --save path/to/ogma-v.X.X.X.tar.gz


import Ogma from 'ogma';

const ogma = new Ogma();
ogma.addNode({id: 0});

You can import some other interfaces from the file if you wish to use them in your code, e.g:

import Ogma, {Node, Color} from 'ogma';

function getColor(node: Node) : Color {
    return node.getAttribute('color');

const ogma = new Ogma();
const node = ogma.addNode({id: 0, attributes: { color: 'blue' }});