Namespace

mx

mx

Container of the Mendix client subsystems.

Namespaces

data
parser
session
ui

Members

string

# static appUrl

Root URL from which application is loaded, e.g. https://domain.com/mendixapp/.

Methods

# static addOnLoad(callback)

Adds a function to be called when the client is finished loading. If the client is already loaded, the function will be called immediately.

Parameters:
Name Type Description
callback mx~AddOnLoadCallback

function to be called when the client is finished loading

Example
mx.addOnLoad(function() {
    console.log("You can use client functionality now");
});

# static login(username, password, onSuccessCallback, onErrorCallback)

Tries to login using a username and password.

Parameters:
Name Type Description
username string

username to login with

password string

password to login with

onSuccessCallback mx~LoginSuccessCallback

called when the login is successful

onErrorCallback mx~LoginUnauthorizedCallback

called when the login failed

Example
mx.login("fred", "fred's unguessable password", function() {
    console.log("success");
}, function() {
    console.log("wrong password");
});

# static login2(username, password, useAuthToken, onSuccessCallback, onErrorCallback)

Tries to login using a username.

Parameters:
Name Type Description
username string

username to login with

password string

password to login with

useAuthToken boolean

stay logged in until token expires

onSuccessCallback mx~LoginSuccessCallback

called when the login is successful

onErrorCallback mx~LoginUnauthorizedCallback

called when the login failed

Example
// Example with useAuthToken set to true
mx.login2("fred", "fred's unguessable password", true, function() {
    console.log("success");
}, function() {
    console.log("wrong password");
});

# static logout()

Logs out the user and restarts the client.

Example
mx.logout();   // Restarts the client.

Type Definitions

# AddOnLoadCallback()

Callback that can be registered with mx.login

# LoginSuccessCallback()

Success callback of mx.login

# LoginUnauthorizedCallback()

Unauthorized callback of mx.login