ajax-module-loader

0.0.8 • Public • Published

Ajax Module Loader

Analyzes page contents to determine what new javascript modules need to be loaded and which old modules need to be unloaded.

Javascript Native API's used:

(polyfill as needed)

Lifecycle

onInit()

This is where you will want to attach any global event listeners to the window or document. It is only called when the user navigates from a page that does not contain this script to one that does.

onLoad(context)

This is where you will want to interact with the DOM. This method is called immediately after onInit with a context of the document. If the user navigates from a page that contains this script to another page that contains this script, onLoad will be called again with a context of the new page's contents.

onUnload(context)

This is where you will want to clean up after leaving a page. In this method, you should remove any event listeners added the DOM elements in the onLoad method. If the new page contains this script, context will be the old page's contents. If the new page does not contain this script, context will be the document. In the latter case, onUnload will be called before onDestroy.

onDestroy()

This method is called when a user navigates from a page that contains this script to one that doesn't. This is where you will want to clean up any global event listeners attached in the onInit method.

Readme

Keywords

none

Package Sidebar

Install

npm i ajax-module-loader

Weekly Downloads

6

Version

0.0.8

License

MIT

Unpacked Size

69.7 kB

Total Files

11

Last publish

Collaborators

  • btpoe