API List
API List
| Method Name | Description |
|---|---|
| start | Initialize LI PASS Web Component |
| unmount | Unload/Close LI PASS Web Component |
| changeLanguage | Switch language, supported languages see language list |
| on | Monitor events, supported events see event list |
| bind | LI PASS Binding Method |
unmount
Calling the unmount method will remove the LI PASS Web component from the DOM.
changeLanguage
You can switch the component language by calling the changeLanguage method; if the input language parameter is not supported, the default language en will be displayed.
Example
// Component switches language to Italian\npass.changeLanguage("it");
Language List
| Code | Language Type |
|---|---|
| ar | Arabic |
| cs | Czech |
| de | German |
| en | English |
| es | Spanish (Latin America) |
| es-eu | Spanish (Europe) |
| fi | Finnish |
| fil-PH | Filipino |
| fr | French |
| hi | Hindi |
| id | Indonesian |
| it | Italian |
| ja | Japanese |
| ko | Korean |
| ms | Malay |
| nl | Dutch |
| pl | Polish |
| pt | Portuguese (Latin America) |
| ru | Russian |
| th | Thai |
| tr | Turkish |
| vi | Vietnamese |
| zh-Hant | Chinese (Traditional) |
| zh-Hans | Chinese (Simplified) |
| zh-TW | Chinese (Taiwan) |
on
The on method provided by the pass component can register callback event handlers.When the user performs operations on the LI PASS Web component, the component will call back at the appropriate times.
note
Ensure to register the event before the user triggers the corresponding event.
Example
pass.on("onLogin", (userInfo) => {\n // After the user fails to log in, the 'onLoginError event' is triggered, and the business logic after successful login can be processed in this event callback\n // such as redirecting to a specific page\n console.log(userInfo);\n});\n\npass.on("onLoginError", (userInfo) => {\n // After the user successfully logs in, the 'onLogin event' is triggered, and the business logic after failed login can be processed in this event callback\n console.log(userInfo);\n});\n\npass.on("onRegister", (userInfo) => {\n // Logic added after successful registration\n // such as redirecting to a specific page\n console.log(userInfo);\n});
Event List
| Method Name | Description | Callback Parameters |
|---|---|---|
| onLoad | Load Rendered Component | accountApi |
| onClose | Close component by clicking close button in modal mode | accountApi |
| onLogin | Login Successful | userInfo, accountApi |
| onLoginError | Login Failed | error |
| onLoginTabChange | Tab Switch on Component | activeTab |
| onRegister | Registration Successful | userInfo, accountApi |
| onRegisterError | Registration Failed | error |
| onPwdReset | Password Reset Successful | accountApi |
| onPwdResetError | Password Reset Failed | error, accountApi |
bind
See binding for details.