1.0.0 • Published 10 years ago

ampersand-view-jquery-mixin v1.0.0

Weekly downloads
49
License
MIT
Repository
github
Last release
10 years ago

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

1.0.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago

0.0.1

10 years ago