Mendix Client 4 API Documentation


mendix.Client

mendix.Client is the client core, responsible for controlling the subsystems. The main client instance is available in global scope via the mx variable (window.mx).

Properties

mobile

A boolean indicating whether the mobile client is used.

baseUrl

This is the url of the xas instance, relative to the project url, which defaults to “xas/”.

modulePath

This is the url of the modules (custom widgets), relative to the dojo dir, which defaults to “../../widgets/”.

meta

This is a reference to the Metasubsystem (mendix.sys.Meta).

data

This is a reference to the Data subsystem (mendix.sys.Data).

remote

This is a reference to the Remote subsystem (mendix.sys.Remote).

session

This is a reference to the Session subsystem (mendix.sys.Session).

server

This is a reference to the Server subsystem (mendix.sys.Server).

xas

This is a reference to the XAS subsystem (mendix.sys.XAS).

config

This is a reference to the Config subsystem (mxui.sys.Config).

parser

This is a reference to the Parser subsystem (mxui.sys.DataParser, mobile.sys.Parser in mobile).

screen

This is a reference to the Screen subsystem (mxui.wm.Screen, not available in mobile).

ui

This is a reference to the UserInterface subsystem (mxui.wm.UserInterface, mobile.sys.UI in mobile).

Methods

addOnLoad(callback)

This method is called to add 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 Function The function to be called when the client is finished loading.

login()

This method is called to authorize the current user. If there is no session yet, or the session has expired, the runtime is probed for a guest account. If anonymous users are not allowed, the login screen is displayed. When autorized the subsystems are started, and the Client is loaded.

logout()

This method is called to shutdown all subsystems when the user logged out.

registerSubSystem(prefix, sub, params)

This method is called to register a subsystem. This should be done before startup is called. A subsystem must at least implement a startup and shutdown method. Startup is called when a user logs in, shutdown is calles when a user logs out.

Parameters

Name Type Description
prefix String The name of the property on the Client instance which should hold a reference to this subsystem.
sub String The declared class name of the subsystem.
params Object Keyword arguments which are passed to the subsystems constructor.

Examples

mx.registerSubSystem("extra", "module.sys.Extra", { prop : true });

startup()

This method is called to startup the Client instance and initialize the subsystems.

isLoaded()

This method is called to check whether all subsystems have been started.

Returns

Type Description
Boolean true if all subsystems have been started.