Skip to content
Benedikt Schulze Baek edited this page Mar 22, 2017 · 5 revisions

If you are about to use the chayns api you need to initialize it first.
Here you can find information to the relating methods. Keep in mind that the chayns.register method is optional to use.

For using chayns you need to include the chayns script to your projects. In addition, the chayns styles must also be loaded so that all functions work properly.


chayns.ready

After the document and chayns are loaded, 'chayns.ready' returns a promise that you can work with.
You can predefine some parameters using chayns.register, explained below.
On success the function in the first '.then'-block will be invoked. If an error occurs the function in the '.catch'-block will be executed instead. The second '.then' function will always be invoked.

Supported Platforms

  • Android
  • iOS
  • ChaynsWeb
chayns.ready.then(function() {
  console.log('Chayns is ready, environment loaded', chayns.env);
}).catch(function() { 
  console.log('No chayns environment found');
}).then(function () { 
  console.log('Will always be executed');
});

chayns.register(config) (optional)

Registers the Tapp with the given config. This function and all parameters are optional. It has to be executed before the chayns.ready function.

Supported Platforms

  • Android
  • iOS
  • ChaynsWeb

Parameter

  • strictMode (optional) : boolean - If true, chayns functions with wrong parameters wont be executed. Default: true.
  • appName (optional) : string - Sets the Tapp name to distinguish logs or local storage entries.
  • cssPrefix (optional) : string - Sets a css class prefix. Default prefix is 'chayns-'.
  • callbackPrefix (optional) : string - Sets a callback name prefix to prevent overwriting.
  • initialHeight (optional) : int - Specifies the initial height for the tapp.
  • autoResize (optional) : boolean - Disables auto resizing for the tapp. Default: false.

Clone this wiki locally