JAVASCRIPT   15

function global factory

Guest on 29th April 2022 01:17:59 AM

  1. function (global, factory) {
  2.   if (typeof define === "function" && define.amd) {
  3.     define('/Base', ['exports', 'jquery', 'Component', 'Plugin'], factory);
  4.   } else if (typeof exports !== "undefined") {
  5.     factory(exports, require('jquery'), require('Component'), require('Plugin'));
  6.   } else {
  7.     var mod = {
  8.       exports: {}
  9.     };
  10.     factory(mod.exports, global.jQuery, global.Component, global.Plugin);
  11.     global.Base = mod.exports;
  12.   }
  13. })(this, function (exports, _jquery, _Component2, _Plugin) {
  14.   'use strict';
  15.  
  16.   Object.defineProperty(exports, "__esModule", {
  17.     value: true
  18.   });
  19.  
  20.   var _jquery2 = babelHelpers.interopRequireDefault(_jquery);
  21.  
  22.   var _Component3 = babelHelpers.interopRequireDefault(_Component2);
  23.  
  24.   var _class = function (_Component) {
  25.     babelHelpers.inherits(_class, _Component);
  26.  
  27.     function _class() {
  28.       babelHelpers.classCallCheck(this, _class);
  29.       return babelHelpers.possibleConstructorReturn(this, (_class.__proto__ || Object.getPrototypeOf(_class)).apply(this, arguments));
  30.     }
  31.  
  32.     babelHelpers.createClass(_class, [{
  33.       key: 'initializePlugins',
  34.       value: function initializePlugins() {
  35.         var context = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  36.  
  37.         (0, _jquery2.default)('[data-plugin]', context || this.$el).each(function () {
  38.           var $this = (0, _jquery2.default)(this),
  39.               name = $this.data('plugin'),
  40.               plugin = (0, _Plugin.pluginFactory)(name, $this, $this.data());
  41.           if (plugin) {
  42.             plugin.initialize();
  43.           }
  44.         });
  45.       }
  46.     }, {
  47.       key: 'initializePluginAPIs',

Raw Paste


Login or Register to edit or fork this paste. It's free.