Skip to content

Instantly share code, notes, and snippets.

@OlehDutchenko
Last active April 16, 2019 20:25
Show Gist options
  • Save OlehDutchenko/ff07a5f5b24917c14b5e52f339a226c1 to your computer and use it in GitHub Desktop.
Save OlehDutchenko/ff07a5f5b24917c14b5e52f339a226c1 to your computer and use it in GitHub Desktop.
'use strict';
/**
* @module
*/
// ----------------------------------------
// Imports
// ----------------------------------------
import $ from 'jquery';
import 'custom-jquery-methods/fn/has-inited-key';
// ----------------------------------------
// Private
// ----------------------------------------
/**
* @param {jQuery} \$element
* @private
*/
function _init (\$element) {
console.log(\$element);
}
// ----------------------------------------
// Public
// ----------------------------------------
/**
* @param {jQuery} \$elements
*/
export function ${moduleMethod} (\$elements) {
\$elements .each((i, element) => {
const \$element = $(element);
if (\$element .hasInitedKey('${moduleMethod}IsInitialized')) {
return true;
}
_init(\$element);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment