Component for initialising widgets around DOM elements
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.gitignore
History.md
Makefile
Readme.md
component.json
index.js
package.json
test.html

Readme.md

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