Reputation: 1111
I am trying to convert this function to es6 sintax:
module.exports = function( key, fieldID ) {
var self = this;
self.Elements = function() {
this.cache = {
$btn: jQuery( '#dav' + key + '_button' ),
$apiField: jQuery( '#dav' + key ),
$apiUrl: jQuery( '#dav' + fieldID ),
};
};
};
Should start like this:
export default ( key, fieldID ) => {
const self = this;
self.Elements = function() {...
What is the correct way to convert this module to es6?
Upvotes: 0
Views: 922
Reputation: 704
I think the following should work:
export default function(key, fieldID) {
var self = this;
self.Elements = function() {
this.cache = {
$btn: jQuery('#dav' + key + '_button'),
$apiField: jQuery('#dav' + key),
$apiUrl: jQuery('#dav' + fieldID),
};
};
}
Upvotes: 1