small-module-js

Easy to use and small module script for in-browser usage.

Usage no npm install needed!

<script type="module">
  import smallModuleJs from 'https://cdn.skypack.dev/small-module-js';
</script>

README

small-module-js

Easy to use and small module script for in-browser usage.

Installation

npm install --save small-module-js

Usage


Module('App.Test', (function () {
    // Set variables for the scope:
    var container = document.querySelector('div#container');

    function handleClick(event) {
        console.log(event);
    }

    function registerEvent() {
        container.addEventListener('click', handleClick);
    }

    // Do everything for initialization:
    function initialize() {
        registerEvent();
    }

    return {
        initialize: initialize,
    };
}));

License

It's MIT.