Initialization and Termination of Framework (Web)

Updated: 01/18/2019

This page is for Cubism version 4.2 or earlier. Click here for the latest version.

Launch

Set logging-related options in the CubismFramework.startUp function.
Without calling this function, the CubismFramework.initialize function to be performed later will not work.

// TypeScript
let cubismOption: Option;

// prepare for Cubism Framework API.
cubismOption.logFunction = LAppPal.printMessage;
cubismOption.loggingLevel = LogLevel.LogLevel_Info;
CubismFramework.startUp(cubismOption);

The argument registers the level of debugging and the function to be debugged.

During initialization, Cubism Core for Web version information is displayed via debugging functions, as shown below.

[CSM][I]Live2D Cubism Core version: 03.00.0003 (50331651)

Initialization

After performing the CubismFramework.startUp function, call the CubismFramework.initialize function.
Always call it once before using the Framework in your application.
If it is never called, an error will occur when using the Framework.
If called in succession, the process is ignored.
However, after calling the CubismFramework.dispose function (described below) and exiting, the initialize function can be called again to initialize it.

// TypeScript
CubismFramework.initialize();

Exit

Calling the CubismFramework.dispose function releases the common part resources allocated by the Framework.
Do not call this function before calling the CubismFramework.initialize function.
Typically, it is called when the application is terminated.
As an exception, in an environment with very little memory, you can call the function to release resources when not needed or when you want to completely detach the library, and then call the CubismFramework.initialize function again the next time you want to use it.

// TypeScript
CubismFramework.dispose();
Was this article helpful?
YesNo
Please let us know what you think about this article.