complete.js 697 B

12345678910111213141516171819202122232425
  1. /**
  2. * Export "splide" function for frontend with full components.
  3. *
  4. * @author Naotoshi Fujita
  5. * @copyright Naotoshi Fujita. All rights reserved.
  6. */
  7. import Splide from '../../src/js/splide';
  8. import { COMPLETE } from '../../src/js/components';
  9. /**
  10. * Create and return a new Splide instance.
  11. *
  12. * @param {Element|string} root - A root element or a selector for it.
  13. * @param {Object} options - Optional. Options overwriting defaults.
  14. *
  15. * @return {Splide} - A Splide instance.
  16. */
  17. export default function splide( root, options = {} ) {
  18. return new Splide( root, options, COMPLETE );
  19. }
  20. // Register the function above as global for non-ES6 environment.
  21. window.splide = splide;