Skip to content

Latest commit

 

History

History
27 lines (17 loc) · 547 Bytes

Readme.md

File metadata and controls

27 lines (17 loc) · 547 Bytes

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