JSFiddle - React, Tailwind, and code Playground
by Nikola Mihin
JavaScript
! function(t, e) {
"object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : t.Shuffle = e()
}(this, function() {
"use strict";
function t(t, e) {
if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function")
}
function e(t, e) {
for (var i = 0; i < e.length; i++) {
var n = e[i];
n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n)
}
}
function i(t, i, n) {
return i && e(t.prototype, i), n && e(t, n), t
}
function n(t) {
return (n = Object.setPrototypeOf ? Object.getPrototypeOf : function(t) {
return t.__proto__ || Object.getPrototypeOf(t)
})(t)
}
function s(t, e) {
return (s = Object.setPrototypeOf || function(t, e) {
return t.__proto__ = e, t
})(t, e)
}
function o(t, e) {
return !e || "object" != typeof e && "function" != typeof e ? function(t) {
if (void 0 === t) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t
}(t) : e
}
function r() {}
r.prototype = {
on: function(t, e, i) {
var n = this.e || (this.e = {});
return (n[t] || (n[t] = [])).push({
fn: e,
ctx: i
}), this
},
once: function(t, e, i) {
var n = this;
function s() {
n.off(t, s), e.apply(i, arguments)
}
return s._ = e, this.on(t, s, i)
},
emit: function(t) {
for (var e = [].slice.call(arguments, 1), i = ((this.e || (this.e = {}))[t] || []).slice(), n = 0, s = i.length; n < s; n++) i[n].fn.apply(i[n].ctx, e);
return this
},
off: function(t, e) {
var i = this.e || (this.e = {}),
n = i[t],
s = [];
if (n && e)
for (var o = 0, r = n.length; o < r; o++) n[o].fn !== e && n[o].fn._ !== e && s.push(n[o]);
return s.length ? i[t] = s :...