Skip to content

carlmw/widget-init

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

widget-init

initialises widgets bound to DOM elements through a data-attribute hook

Installation

$ component install carlmw/widget-init

Example

<div id="target" data-require="test-widget" data-foo-bar="baz">Target Element</div>
<script>
require.register("test-widget", function(module){
  module.exports = function (el, dataset) {
    // el => div#target
    // dataset => {fooBar: "baz", require: "test-widget"}
  };
});

require('widget-init')(document);
</script>

License

MIT

About

Component for initialising widgets around DOM elements

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published