Skip to content

Commit

Permalink
chore: update to 7aaf8c1 [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
vis-bot committed Nov 24, 2023
1 parent 35af84f commit 5632637
Show file tree
Hide file tree
Showing 27 changed files with 453 additions and 788 deletions.
233 changes: 83 additions & 150 deletions dist/esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Create interactive, animated 3d graphs. Surfaces, lines, dots and block styling out of the box.
*
* @version 0.0.0-no-version
* @date 2023-11-20T12:37:00.647Z
* @date 2023-11-24T17:23:15.747Z
*
* @copyright (c) 2011-2017 Almende B.V, http://almende.com
* @copyright (c) 2017-2019 visjs contributors, https://github.com/visjs
Expand Down Expand Up @@ -4442,179 +4442,112 @@ var _fillInstanceProperty = /*@__PURE__*/getDefaultExportFromCjs(fill);
var componentEmitter = {exports: {}};

(function (module) {
/**
* Expose `Emitter`.
*/
function Emitter(object) {
if (object) {
return mixin(object);
}

{
module.exports = Emitter;
this._callbacks = new Map();
}

/**
* Initialize a new `Emitter`.
*
* @api public
*/

function Emitter(obj) {
if (obj) return mixin(obj);
}
/**
* Mixin the emitter properties.
*
* @param {Object} obj
* @return {Object}
* @api private
*/

function mixin(obj) {
for (var key in Emitter.prototype) {
obj[key] = Emitter.prototype[key];
}
return obj;
function mixin(object) {
Object.assign(object, Emitter.prototype);
object._callbacks = new Map();
return object;
}

/**
* Listen on the given `event` with `fn`.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/

Emitter.prototype.on =
Emitter.prototype.addEventListener = function(event, fn){
this._callbacks = this._callbacks || {};
(this._callbacks['$' + event] = this._callbacks['$' + event] || [])
.push(fn);
return this;
Emitter.prototype.on = function (event, listener) {
const callbacks = this._callbacks.get(event) ?? [];
callbacks.push(listener);
this._callbacks.set(event, callbacks);
return this;
};

/**
* Adds an `event` listener that will be invoked a single
* time then automatically removed.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/

Emitter.prototype.once = function(event, fn){
function on() {
this.off(event, on);
fn.apply(this, arguments);
}
Emitter.prototype.once = function (event, listener) {
const on = (...arguments_) => {
this.off(event, on);
listener.apply(this, arguments_);
};

on.fn = fn;
this.on(event, on);
return this;
on.fn = listener;
this.on(event, on);
return this;
};

/**
* Remove the given callback for `event` or all
* registered callbacks.
*
* @param {String} event
* @param {Function} fn
* @return {Emitter}
* @api public
*/

Emitter.prototype.off =
Emitter.prototype.removeListener =
Emitter.prototype.removeAllListeners =
Emitter.prototype.removeEventListener = function(event, fn){
this._callbacks = this._callbacks || {};

// all
if (0 == arguments.length) {
this._callbacks = {};
return this;
}
Emitter.prototype.off = function (event, listener) {
if (event === undefined && listener === undefined) {
this._callbacks.clear();
return this;
}

if (listener === undefined) {
this._callbacks.delete(event);
return this;
}

const callbacks = this._callbacks.get(event);
if (callbacks) {
for (const [index, callback] of callbacks.entries()) {
if (callback === listener || callback.fn === listener) {
callbacks.splice(index, 1);
break;
}
}

// specific event
var callbacks = this._callbacks['$' + event];
if (!callbacks) return this;
if (callbacks.length === 0) {
this._callbacks.delete(event);
} else {
this._callbacks.set(event, callbacks);
}
}

// remove all handlers
if (1 == arguments.length) {
delete this._callbacks['$' + event];
return this;
}
return this;
};

// remove specific handler
var cb;
for (var i = 0; i < callbacks.length; i++) {
cb = callbacks[i];
if (cb === fn || cb.fn === fn) {
callbacks.splice(i, 1);
break;
}
}
Emitter.prototype.emit = function (event, ...arguments_) {
const callbacks = this._callbacks.get(event);
if (callbacks) {
// Create a copy of the callbacks array to avoid issues if it's modified during iteration
const callbacksCopy = [...callbacks];

// Remove event specific arrays for event types that no
// one is subscribed for to avoid memory leak.
if (callbacks.length === 0) {
delete this._callbacks['$' + event];
}
for (const callback of callbacksCopy) {
callback.apply(this, arguments_);
}
}

return this;
return this;
};

/**
* Emit `event` with the given args.
*
* @param {String} event
* @param {Mixed} ...
* @return {Emitter}
*/

Emitter.prototype.emit = function(event){
this._callbacks = this._callbacks || {};

var args = new Array(arguments.length - 1)
, callbacks = this._callbacks['$' + event];
Emitter.prototype.listeners = function (event) {
return this._callbacks.get(event) ?? [];
};

for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
Emitter.prototype.listenerCount = function (event) {
if (event) {
return this.listeners(event).length;
}

if (callbacks) {
callbacks = callbacks.slice(0);
for (var i = 0, len = callbacks.length; i < len; ++i) {
callbacks[i].apply(this, args);
}
}
let totalCount = 0;
for (const callbacks of this._callbacks.values()) {
totalCount += callbacks.length;
}

return this;
return totalCount;
};

/**
* Return array of callbacks for `event`.
*
* @param {String} event
* @return {Array}
* @api public
*/

Emitter.prototype.listeners = function(event){
this._callbacks = this._callbacks || {};
return this._callbacks['$' + event] || [];
Emitter.prototype.hasListeners = function (event) {
return this.listenerCount(event) > 0;
};

/**
* Check if this emitter has `event` handlers.
*
* @param {String} event
* @return {Boolean}
* @api public
*/

Emitter.prototype.hasListeners = function(event){
return !! this.listeners(event).length;
};
// Aliases
Emitter.prototype.addEventListener = Emitter.prototype.on;
Emitter.prototype.removeListener = Emitter.prototype.off;
Emitter.prototype.removeEventListener = Emitter.prototype.off;
Emitter.prototype.removeAllListeners = Emitter.prototype.off;

{
module.exports = Emitter;
}
} (componentEmitter));

var componentEmitterExports = componentEmitter.exports;
Expand Down
2 changes: 1 addition & 1 deletion dist/esm.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/vis-graph3d.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vis-graph3d.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion esnext/esm/vis-graph3d.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esnext/esm/vis-graph3d.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esnext/umd/vis-graph3d.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion esnext/umd/vis-graph3d.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5632637

Please sign in to comment.