Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Component for initialising widgets around DOM elements

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 History.md
Octocat-spinner-32 Makefile
Octocat-spinner-32 Readme.md
Octocat-spinner-32 component.json
Octocat-spinner-32 index.js
Octocat-spinner-32 package.json
Octocat-spinner-32 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

Something went wrong with that request. Please try again.