mendix-client
TypeScript icon, indicating that this package has built-in type declarations

7.15.8 • Public • Published

Mendix Client API Type definition

This type definition is based on the Mendix client API documentation

https://apidocs.mendix.com/7/client/

Installation

npm install --save-dev mendix-client

  • Add to your tsconfig.json
{
    "compilerOptions": {
        "types": [ "mendix-client" ]
    }
}

Usage

Typescript sample works as a Mendix Dojo widget

import * as dojoDeclare from "dojo/_base/declare";
import * as WidgetBase from "mxui/widget/_WidgetBase";
 
export class MyWidget extends WidgetBase {
    // Properties from Mendix modeler
    private message: string; 
    // Don`t assign default values, as the constructor will never be executed
    // alternative set them in the postCreate
    // private info: "Hello World"; 
    
    postCreate() {
        console.log("We have a widget ", this.message);
    }
 
    update(object: mendix.lib.MxObject, callback?: Function) {
        console.log("We have a context", object);
 
        if (callback) {
            callback();
        }
    }
}
 
dojoDeclare("com.mendix.widget.mywidget.MyWidget", [ WidgetBase ], (function(Source: any) {
    const result: any = {};
    for (const i in Source.prototype) {
        if (i !== "constructor" && Source.prototype.hasOwnProperty(i)) {
            result[i] = Source.prototype[i];
        }
    }
    return result;
}(MyWidget)));

More info about the Dojo declare hack for TypesScript: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/types-2.0/dojo/README.md

Dependency

Package Sidebar

Install

npm i mendix-client

Weekly Downloads

200

Version

7.15.8

License

Apache-2.0

Unpacked Size

54.9 kB

Total Files

10

Last publish

Collaborators

  • flockofbirds