var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
plugin.uuid = this.GetYoDigits(6, pluginName);
- if(!plugin.$element.attr('data-' + pluginName)){ plugin.$element.attr('data-' + pluginName, plugin.uuid); }
+ if(!plugin.$element.attr(`data-${pluginName}`)){ plugin.$element.attr(`data-${pluginName}`, plugin.uuid); }
if(!plugin.$element.data('zfPlugin')){ plugin.$element.data('zfPlugin', plugin); }
/**
* Fires when the plugin has initialized.
* @event Plugin#init
*/
- plugin.$element.trigger('init.zf.' + pluginName);
+ plugin.$element.trigger(`init.zf.${pluginName}`);
this._uuids.push(plugin.uuid);
var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
- plugin.$element.removeAttr('data-' + pluginName).removeData('zfPlugin')
+ plugin.$element.removeAttr(`data-${pluginName}`).removeData('zfPlugin')
/**
* Fires when the plugin has been destroyed.
* @event Plugin#destroyed
*/
- .trigger('destroyed.zf.' + pluginName);
+ .trigger(`destroyed.zf.${pluginName}`);
for(var prop in plugin){
plugin[prop] = null;//clean up script to prep for garbage collection.
}
*/
GetYoDigits: function(length, namespace){
length = length || 6;
- return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? '-' + namespace : '');
+ return Math.round((Math.pow(36, length + 1) - Math.random() * Math.pow(36, length))).toString(36).slice(1) + (namespace ? `-${namespace}` : '');
},
/**
* Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
}
}else{//error for invalid argument type
- throw new TypeError("We're sorry, '" + type + "' is not a valid parameter. You must use a string representing the method you wish to invoke.");
+ throw new TypeError(`We're sorry, ${type} is not a valid parameter. You must use a string representing the method you wish to invoke.`);
}
return this;
};