ampersand-view-jquery-mixin

1.0.0 • Public • Published

ampersand-view-jquery-mixin

A mixin for extending ampersand-view with this.$ and this.$el known from Backbone views. This makes migrating Backbone or HumanJS views to Ampersand a bit easier. Includes a dependency to jQuery 2.

install

npm install ampersand-view-jquery-mixin

usage

This will load jQuery via require()

var View = require('ampersand-view');
var jqueryMixin = require('ampersand-view-jquery-mixin');
 
 
module.exports = View.extend(jqueryMixin, {
    sampleMethod: function () {
        // now we've got jQuery helpers
        this.$( ... );
        this.$el[0];
        // ...
    }
});

usage when jQuery is already available as window.$

This will use an existing window.$ so that not another copy of jQuery is loaded.

var View = require('ampersand-view');
var jqueryMixin = require('ampersand-view-jquery-mixin/no-bundled-jquery');
 
 
module.exports = View.extend(jqueryMixin, {
   // ...
});

license

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    1
  • 0.2.0
    0
  • 0.1.0
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i ampersand-view-jquery-mixin

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • whobubble