Overview
Mobi provides a powerful code extension feature. You can use custom JavaScript code and integrate third-party libraries to extend your application's functionality. The code runs in a user-specific environment.
Overview
The Mobi low-code development platform simplifies the application building process, which lowers the technical barrier and helps you develop applications more easily. However, because every project is unique and may require additional flexibility and customization, Mobi provides a powerful code extension feature. This feature lets you use custom JavaScript code and integrate third-party libraries to expand your application's functionality. The code extension feature bridges the gap between low-code development and traditional coding. This greatly improves development efficiency and ensures that your application remains flexible and customizable.
Code extension capabilities
The code extension feature includes two main aspects:
Preloaded JS
Preloaded JS lets you run custom JavaScript code when your application loads. You can use this code to define global variables or create functions on the window object, which adds new behaviors or features to your application.
Add global variables: You can share data across the entire application lifecycle.
Define window-scoped functions: You can call these functions from anywhere in your application.
Third-party libraries
You can integrate third-party libraries, such as Lodash and Moment.js, to extend your application's functionality. These libraries usually provide a robust set of APIs that can greatly simplify common programming tasks.
Custom code libraries: You can import specialized code libraries to implement specific features.
UMD format support: This ensures that third-party libraries can be attached directly to the
windowenvironment.
Scenarios
The code extension feature is useful in many scenarios, such as:
Creating complex data processing logic.
Implementing custom user interaction features.
Integrating APIs from external services.
Providing dynamic content updates and state management.
Notes
When you use the code extension feature, keep the following points in mind:
Performance: Ensure that custom code and third-party libraries do not negatively affect your application's load time or runtime performance.
Security: Avoid exposing sensitive information in your code and ensure that your code is secure.
Error handling: Implement proper error handling to prevent issues in custom code or third-party libraries from affecting the entire application.
Licensing and compliance: When you use third-party libraries, you must adhere to their license terms to ensure legal compliance.