I would like ask some help because i can\'t convert my classic jQuery (v2) plugin in ES6 with module and class.
In ECMAScript 5, we can attach jQuery plugin into jQuery
You install new methods on the jQuery prototype in ES6 just as you always did. Nothing has changed for them. You're not going to subclass jQuery, so it makes no sense to use class
or extends
.
// myPlugin.es6:
import $ from 'jquery';
$.fn.myPlugin = function() {
…
};
// app.es6:
import $ from 'jquery';
import 'myPlugin.es6';
$('div').myPlugin();