Function get

Loads the specified URL asynchronously and invokes the given functions depending on the request status. Returns the MaxXmlRequest in use. Both functions take the MaxXmlRequest as the only parameter. See load for a synchronous implementation.

Example:

get(url, (req) => {
const node = req.getDocumentElement();
// Process XML DOM...
});

So for example, to load a diagram into an existing graph model, the following code is used.

get(url, (req) => {
const node = req.getDocumentElement();
const dec = new Codec(node.ownerDocument);
dec.decode(node, graph.getDataModel());
});
  • Parameters

    • url: string

      URL to get the data from.

    • onload: null | Function = null

      Optional function to execute for a successful response.

    • onerror: null | Function = null

      Optional function to execute on error.

    • binary: boolean = false

      Optional boolean parameter that specifies if the request is binary.

    • timeout: null | number = null

      Optional timeout in ms before calling ontimeout.

    • ontimeout: null | Function = null

      Optional function to execute on timeout.

    • headers: null | { [key: string]: string } = null

      Optional with headers, eg. {'Authorization': 'token xyz'}

    Returns MaxXmlRequest