Dynamic Script Loading for Mobile App Resource Management
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Mobile devices face challenges in efficiently managing and loading JavaScript applications due to limited resources, as JSContext does not support loading webpack resources from the network, leading to increased battery consumption and memory usage when all modules are loaded at once.
Innovation Solution
Implementing a context manager that dynamically loads only the entry point application module initially and loads resource modules as needed, reducing the initial load time and resource consumption by using a bundler like Webpack to package modules into a smaller resource bundle.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If all JavaScript modules are loaded into JSContext at once, then the application is fully functional, but battery consumption and memory usage increase significantly
Solution Approach 1:
The patent divides the JavaScript application into separate modules that can be loaded independently into JSContext. Instead of loading all modules at once, the system loads only the entry point module initially and dynamically loads additional modules as they are needed during execution. This segmentation reduces the initial memory footprint and battery consumption while maintaining full application functionality through on-demand loading.
2Reliability
If all JavaScript modules are loaded into JSContext at once, then the application is fully functional, but memory usage increases significantly
Solution Approach 1:
The patent segments the JavaScript application into modular components that can be independently managed in memory. The entry point module is loaded first, and other modules are loaded only when required during runtime. This approach reduces the initial memory allocation while ensuring that the application remains fully functional through dynamic module loading.
3Adaptability or versatility
If JSContext loads webpack resources from the network, then resource loading is flexible, but JSContext lacks the necessary browser functionality to do so
Solution Approach 1:
The patent introduces an intermediary mechanism that bridges the gap between JSContext's limited capabilities and the need for network resource loading. The mobile application acts as a mediator by downloading webpack resource bundles from the network using its native network capabilities, then injecting these resources into JSContext. This approach provides network loading flexibility without requiring JSContext to have built-in browser functionality.
Solution Approach 2:
The mobile application performs the resource loading service itself rather than relying on JSContext to do it. The application downloads resource bundles, parses them, and injects the necessary JavaScript modules into JSContext manually. This self-service approach allows the system to achieve network loading flexibility while keeping JSContext's functionality simple and unchanged.
4Ease of operation
If the application is hardcoded to manually load specific resource bundles, then resource loading is controlled, but the initial load time increases
Solution Approach 1:
The patent segments the resource loading process into phases: initial loading of only the entry point module, and subsequent dynamic loading of other modules as needed. This segmentation reduces the initial startup time significantly while maintaining controlled resource loading through the application's manual loading mechanism. The entry point module contains enough information to bootstrap the application and request additional modules on-demand.
Data Source
AI summary
The present disclosure provides a mobile App to provide a runtime environment on a mobile device. As part of start up processing, the mobile App can receive a resource bundle that contains an entry point application module and one or more resource modules. In some embodiments, the resource bundle contains no resource modules. The mobile App can load the entry point application module without loading the resource modules into the runtime environment, and start code execution. When a request for a resource module is encountered during code execution, the mobile App can access the requested resource module and load it into the runtime environment.


