All versions of this documentation

Integration with TypeScript Download code

If you wish to use Ogma within a TypeScript application, assuming your files ogma.min.js and ogma.min.d.ts are in the same location:

import Ogma from '/path/to/ogma.min';

let 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 '/path/to/ogma.min';

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

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