summaryrefslogtreecommitdiff
path: root/html/content/lib/emitter/dist/emitter.js
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 23:57:48 +0200
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-03-12 23:57:48 +0200
commit7aa203150fc1a2ec79c681c13f0d486d531746eb (patch)
treef09ba9f69ccd434e9c7fdeb41807fc8008784d8a /html/content/lib/emitter/dist/emitter.js
parent221af3a2e035bd6689294509feb52f286d3bd5be (diff)
downloadclassroom-7aa203150fc1a2ec79c681c13f0d486d531746eb.tar.gz
classroom-7aa203150fc1a2ec79c681c13f0d486d531746eb.tar.bz2
classroom-7aa203150fc1a2ec79c681c13f0d486d531746eb.zip
error pages; js system to support back/front-end
Diffstat (limited to 'html/content/lib/emitter/dist/emitter.js')
-rw-r--r--html/content/lib/emitter/dist/emitter.js88
1 files changed, 0 insertions, 88 deletions
diff --git a/html/content/lib/emitter/dist/emitter.js b/html/content/lib/emitter/dist/emitter.js
deleted file mode 100644
index 6b2a6fa..0000000
--- a/html/content/lib/emitter/dist/emitter.js
+++ /dev/null
@@ -1,88 +0,0 @@
-(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define(factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.emitter = factory());
-}(this, (function () { 'use strict';
-
- function emitter(context, options) {
- var _events = {}, o = options || {}, _constantEvents = {}, noop = function(){};
-
- function invoke(handler, args){
- window.setTimeout(function () {
- handler.apply(context, args);
- });
- }
-
- function emit(event) {
- var handlers = (_events[event] || (_events[event] = []));
- if (!handlers){
- return;
- }
- var args = Array.prototype.slice.call(arguments, 1);
- if (o.emitting) {
- o.emitting({ event: event, data: args, context: context });
- }
- for (var i = 0, l = handlers.length; i < l; i++) {
- invoke(handlers[i], args);
- }
- }
-
- function replay (event) {
- var args = Array.prototype.slice.call(arguments, 1);
- _constantEvents[event] = args;
- emit.apply(null, arguments);
- }
-
- function on(event, fn) {
- if (_constantEvents[event]){
- invoke(fn, _constantEvents[event]);
- return noop;
- }
- var handlers = (_events[event] || (_events[event] = []));
- handlers.push(fn);
- return function () {
- off(event, fn);
- };
- }
-
- function off(event, fn) {
- var handlers = _events[event], i, h;
- if (!handlers) {
- return;
- }
- if (Array.isArray(event)) {
- for (i = 0, l = event.length; i < l; i++) {
- off(event[i], fn);
- }
- return;
- }
- i = handlers.length;
- while(i--) {
- h = handlers[i];
- if (fn === h){
- handlers.splice(i, 1);
- break;
- }
- }
- }
-
- function once(event, fn) {
- var unsub = on(event, function () {
- fn.apply(context, arguments);
- unsub();
- });
- return unsub;
- }
-
- return {
- on: on,
- off: off,
- emit: emit,
- once: once,
- replay: replay
- };
- }
-
- return emitter;
-
-})));