Framework for dependency management and automatic file load in a network environment
Abstract
An example method for facilitating a framework for dependency management and automatic file load in a network environment is provided and includes deriving dependencies and loading methods of JavaScript files and Cascading Style Sheets (CSS) files referenced by an application source code executing at a browser on a client in a network environment, where the dependencies and loading methods are derived according to a map file accessed from a server, and automatically loading the JavaScript files and CSS files according to the dependencies and loading methods. In a specific embodiment, the map file comprises an Extensible Markup Language (XML) configuration file, which is generated by parsing each JavaScript file for the dependencies and the loading methods. In another embodiment, the map file comprises a JavaScript Object Notation (JSON) file, which is generated by parsing each JavaScript file and CSS file for methods and class names, respectively.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. A method, comprising:
intercepting, at a client during execution of an application at a browser on the client, a JavaScript call, wherein a source code of the application indicates a timed sequence of execution of JavaScript files, wherein the JavaScript files comprise a first JavaScript file loaded into the client's memory element simultaneously with loading the application, a second JavaScript file having a dependency on the first JavaScript file and called during the timed sequence after the first JavaScript file is called, and a third JavaScript file not called after a certain duration of the timed sequence;
accessing, by the client, a map file stored at a server upon intercepting the JavaScript call, wherein the map file is generated automatically at the server before execution of the application on the client, wherein the map file includes a dependency tree comprising the JavaScript files used in the source code, wherein the first JavaScript file is specified in an exclusion file, wherein the map file maps the second JavaScript file for lazy loading, wherein the map file maps Cascading Style Sheets (CSS) files with related map for class names to be used on the application;
reverse mapping from the map file, at the client during runtime of the application, particular JavaScript files corresponding the JavaScript call, wherein the reverse mapping comprises checking the JavaScript call for dependency resolution according to the map file, wherein a resolution scope of lazily loaded files ends with first-level dependencies of such files, wherein the particular JavaScript files are selected for loading according to the dependency resolution;
loading the particular JavaScript files from the server into the client's memory element according to the exclusion file and the map file, wherein the loading comprises loading the first JavaScript file according to the exclusion file, lazy loading the second JavaScript file asynchronously with timestamp according to the map file, and reverse mapping relevant CSS files in the loaded files using related class names from the map file; and
deleting, during application execution, the third JavaScript file from the client's memory element after the certain duration of the timed sequence.
2. The method of claim 1 , wherein the map file comprises an Extensible Markup Language (XML) configuration file, wherein the XML configuration file is generated by parsing each JavaScript file for the dependencies and the loading methods.
3. The method of claim 1 , wherein the map file comprises a JavaScript Object Notation (JSON) file, wherein the JSON file is generated by parsing each JavaScript file and CSS file for methods and class names, respectively.
4. The method of claim 3 , wherein the JSON file specifies substantially all JavaScript files and CSS files to be loaded asynchronously and certain other JavaScript files and CSS files to be loaded directly at initial application load, wherein any JavaScript files and CSS files excluded from asynchronous loading and loading directly at initial application load are specified in a separate exclusion file located at the server.
5. The method of claim 4 , wherein substantially all JavaScript files and CSS files that are to be loaded asynchronously are lazily loaded with timestamps.
6. The method of claim 1 , further comprising:
parsing the map file, wherein the executing application source code specifies onload of a page in the application, wherein the dependency tree of the map file specifies class names listed against corresponding Cascading Style Sheet (CSS) files;
determining related class names used on the page;
reverse mapping the map file using the class names to determine respective CSS files associated with the page; and
asynchronously loading the CSS files based on the reverse mapping.
7. The method of claim 1 , further comprising:
checking the JavaScript call for dependency resolution according to the map file, wherein the map file specifies a first set of dependent JavaScript files to be lazily loaded and a second set of dependent JavaScript files to be loaded during initial application load;
lazily loading the first set of dependent JavaScript file; and
loading the second set of dependent JavaScript file during initial application load.
8. The method of claim 1 , further comprising lazily loading substantially all dependent JavaScript files if the map file is not found.
9. The method of claim 8 , wherein the JavaScript files are lazily loaded according to the dependency tree, wherein the dependency tree is generated at the server by parsing substantially all JavaScript files referenced by the application source code.
10. Non-transitory media encoded in logic that includes instructions for execution that when executed by a processor, is operable to perform operations comprising:
intercepting, at a client during execution of an application at a browser on the client, a JavaScript call, wherein a source code of the application indicates a timed sequence of execution of JavaScript files, wherein the JavaScript files comprise a first JavaScript file loaded into the client's memory element simultaneously with loading the application, a second JavaScript file having a dependency on the first JavaScript file and called during the timed sequence after the first JavaScript file is called, and a third JavaScript file not called after a certain duration of the timed sequence;
accessing, by the client, a map file stored at a server upon intercepting the JavaScript call, wherein the map file is generated automatically at the server before execution of the application on the client, wherein the map file includes a dependency tree comprising the JavaScript files used in the source code, wherein the first JavaScript file is specified in an exclusion file, wherein the map file maps the second JavaScript file for lazy loading, wherein the map file maps Cascading Style Sheets (CSS) files with related map for class names to be used on the application;
reverse mapping from the map file, at the client during runtime of the application, particular JavaScript files corresponding to the JavaScript call, wherein the reverse mapping comprises checking the JavaScript call for dependency resolution according to the map file, wherein a resolution scope of lazily loaded files ends with first-level dependencies of such files, wherein the particular JavaScript files are selected for loading according to the dependency resolution;
loading the particular JavaScript files from the server into the client's memory element according to the exclusion file and the map file, wherein the loading comprises loading the first JavaScript file according to the exclusion file, lazy loading the second JavaScript file asynchronously with timestamp according to the map file, and reverse mapping relevant CSS files in the loaded files using related class names from the map file; and
deleting, during application execution, the third JavaScript file from the client's memory element after the certain duration of the timed sequence.
11. The media of claim 10 , wherein the map file comprises an XML configuration file, wherein the XML configuration file is generated by parsing each JavaScript file for the dependencies and the loading methods.
12. The media of claim 10 , wherein the map file comprises a JSON file, wherein the JSON file is generated by parsing each JavaScript file and CSS file for methods and class names, respectively.
13. The media of claim 10 , wherein the operations further comprise:
checking the JavaScript call for dependency resolution according to the map file, wherein the map file specifies a first set of dependent JavaScript files to be lazily loaded and a second set of dependent JavaScript files to be loaded during initial application load;
lazily loading the first set of dependent JavaScript file; and
loading the second set of dependent JavaScript file during initial application load.
14. The media of claim 10 , wherein the operations further comprise lazily loading substantially all dependent JavaScript files if the map file is not found.
15. An apparatus, comprising:
a browser;
a memory element for storing data; and
a processor that executes instructions associated with the data, wherein the processor and the memory element cooperate such that the apparatus is configured as a client for:
intercepting, at the client during execution of an application at the browser, a JavaScript call, wherein a source code of the application indicates a timed sequence of execution of JavaScript files, wherein the JavaScript files comprise a first JavaScript file loaded into the client's memory element simultaneously with loading the application, a second JavaScript file having a dependency on the first JavaScript file and called during the timed sequence after the first JavaScript file is called, and a third JavaScript file not called after a certain duration of the timed sequence;
accessing, by the client, a map file stored at a server upon intercepting the JavaScript call, wherein the map file is generated automatically at the server before execution of the application on the client, wherein the map file includes a dependency tree comprising the JavaScript files used in the source code, wherein the first JavaScript file is specified in an exclusion file, wherein the map file maps the second JavaScript file for lazy loading, wherein the map file maps Cascading Style Sheets (CSS) files with related map for class names to be used on the application;
reverse mapping from the map file, at the client during runtime of the application, particular JavaScript files corresponding to the JavaScript call, wherein the reverse mapping comprises checking the JavaScript call for dependency resolution according to the map file, wherein a resolution scope of lazily loaded files ends with first-level dependencies of such files, wherein the particular JavaScript files are selected for loading according to the dependency resolution;
loading the particular JavaScript files from the server into the client's memory element according to the exclusion file and the map file, wherein the loading comprises loading the first JavaScript file according to the exclusion file, lazy loading the second JavaScript file asynchronously with timestamp according to the map file, and reverse mapping relevant CSS files in the loaded files using related class names from the map file; and
deleting, during application execution, the third JavaScript file from the client's memory element after the certain duration of the timed sequence.
16. The apparatus of claim 15 , wherein the map file comprises an XML configuration file, wherein the XML configuration file is generated by parsing each JavaScript file for the dependencies and the loading methods.
17. The apparatus of claim 15 , wherein the map file comprises a JSON file, wherein the JSON file is generated by parsing each JavaScript file and CSS file for methods and class names, respectively.
18. The apparatus of claim 15 , further configured for:
checking the JavaScript call for dependency resolution according to the map file, wherein the map file specifies a first set of dependent JavaScript files to be lazily loaded and a second set of dependent JavaScript files to be loaded during initial application load;
lazily loading the first set of dependent JavaScript file; and
loading the second set of dependent JavaScript file during initial application load.
19. The apparatus of claim 18 , further configured for lazily loading substantially all dependent JavaScript files if the map file is not found.Join the waitlist — get patent alerts
Track US9785452B2 — get alerts on status changes and closely related new filings.
We store only your email — no account needed. See our privacy policy.