22.0.0 • Published 8 years ago

mu-jquery-app v22.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
8 years ago

µ jQuery Application Toolkit

Installation

npm install mu-jquery-app --save
bower install mu-jquery-app --save

QuickStart your app in 3 steps

Check out the source or try a live example.

Application

file: app.js.

(function (modules, factory) {
  var root = this;
  factory.apply(root, modules.map(function (m) {
    return this[m] || root[m];
  }, {
      "jquery": root.jQuery
    }));
})(["jquery", "mu-jquery-capture/add", "mu-jquery-loom/jquery.loom"], function (jQuery, add, loom) {
  var root = this;

  function load(name) {
    return root[name];
  }

  // Replace jQuery.event.add with a version that captures event results
  jQuery.event.add = add(jQuery);

  // Extend jQuery.fn with .crank/.weave
  loom.call(jQuery.fn, "mu-widget", load);

  // Wait for document ready and weave the document element
  jQuery(function ($) {
    $(document).weave().fail(console.error.bind(console));
  });
});

Widget

file: widget.js

(function (modules, factory) {
  var root = this;
  root["package/widget"] = factory.apply(root, modules.map(function (m) {
    return this[m] || root[m.replace(/^\./, "package")];
  }));
})(["mu-jquery-widget/widget"], function (widget) {
  return widget.extend({
    "on/click": function ($event) {
      console.log("clicked");
    }
  });
});

HTML

file: index.html

<!DOCTYPE html>
<html>
  <body>
    <button mu-widget="package/widget">click me</button>
  </body>
  <script src="https://rawgit.com/jquery/jquery/3.2.1/dist/jquery.js"></script>
  <script src="https://rawgit.com/mu-lib/mu-jquery-app/master/dist/mu-jquery-app.min.js"></script>
  <script src="widget.js"></script>
  <script src="app.js"></script>
</html>
22.0.0

8 years ago

21.0.0

9 years ago

20.0.2

9 years ago

20.0.1

9 years ago

20.0.0

9 years ago

19.0.2

9 years ago

19.0.1

9 years ago

19.0.0

9 years ago

18.1.0

9 years ago

18.0.0

9 years ago

17.0.6

9 years ago

17.0.5

9 years ago

17.0.4

9 years ago

17.0.3

9 years ago

17.0.2

9 years ago

17.0.1

9 years ago

17.0.0

9 years ago

16.1.0

9 years ago

16.0.0

9 years ago

15.1.2

9 years ago

15.1.1

9 years ago

15.1.0

9 years ago

15.0.1

9 years ago

15.0.0

9 years ago

14.0.1

9 years ago

14.0.0

9 years ago

13.1.0

9 years ago

13.0.1

9 years ago

13.0.0

9 years ago

12.0.0

9 years ago

11.0.0

9 years ago

10.0.0

9 years ago

9.0.2

9 years ago

9.0.1

9 years ago

9.0.0

9 years ago

8.0.2

9 years ago

8.0.1

9 years ago

8.0.0

10 years ago

7.0.0

10 years ago

6.4.0

10 years ago

6.3.0

10 years ago

6.2.0

10 years ago

6.1.1

10 years ago

6.1.0

10 years ago

6.0.0

10 years ago

5.0.1

10 years ago

5.0.0

10 years ago

4.4.0

10 years ago

4.3.0

10 years ago

4.2.0

10 years ago

4.1.0

10 years ago

4.0.1

10 years ago