Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

backbone-esnext-events

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

backbone-esnext-events - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

.tjsdoc/virtual/remote/index.js

3

CHANGELOG.md

@@ -0,2 +1,5 @@

## 0.3.1 (2017-01-27)
- Added TJSDoc external references
## 0.3.0 (2017-01-07)
- Added EventProxy which provides a protected proxy between a target eventbus and actual usage.

155

dist/TyphonEvents.js

@@ -248,79 +248,2 @@ 'use strict';

* A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual
* cases speedy (most internal Backbone events have 3 arguments). This dispatch method passes back an array with
* all results returned by any invoked targets.
*
* @param {Array<*>} events - Array of stored event callback data.
* @param {Array<*>} args - Arguments supplied to `triggerSync`.
* @returns {Array<*>}
*/
var s_TRIGGER_SYNC_EVENTS = function s_TRIGGER_SYNC_EVENTS(events, args) {
var ev = void 0,
i = -1;
var a1 = args[0],
a2 = args[1],
a3 = args[2],
l = events.length;
var result = void 0;
var results = [];
switch (args.length) {
case 0:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
case 1:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx, a1);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
case 2:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx, a1, a2);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
case 3:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
default:
while (++i < l) {
result = (ev = events[i]).callback.apply(ev.ctx, args);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
}
// Return the results array if there are more than one or just a single result.
return results.length > 1 ? results : result;
};
/**
* A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual
* cases speedy (most internal Backbone events have 3 arguments). This dispatch method uses ES6 Promises and adds

@@ -407,4 +330,82 @@ * any returned results to an array which is added to a Promise.all construction which passes back a Promise which

// If there are multiple results then use Promise.all otherwise Promise.resolve.
return results.length > 1 ? Promise.all(results) : Promise.resolve(result);
};
/**
* A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual
* cases speedy (most internal Backbone events have 3 arguments). This dispatch method synchronously passes back a
* single value or an array with all results returned by any invoked targets.
*
* @param {Array<*>} events - Array of stored event callback data.
* @param {Array<*>} args - Arguments supplied to `triggerSync`.
* @returns {*|Array<*>}
*/
var s_TRIGGER_SYNC_EVENTS = function s_TRIGGER_SYNC_EVENTS(events, args) {
var ev = void 0,
i = -1;
var a1 = args[0],
a2 = args[1],
a3 = args[2],
l = events.length;
var result = void 0;
var results = [];
switch (args.length) {
case 0:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
case 1:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx, a1);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
case 2:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx, a1, a2);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
case 3:
while (++i < l) {
result = (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
default:
while (++i < l) {
result = (ev = events[i]).callback.apply(ev.ctx, args);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') {
results.push(result);
}
}
break;
}
// Return the results array if there are more than one or just a single result.
return results.length > 1 ? results : result;
};
module.exports = exports['default'];
{
"name": "backbone-esnext-events",
"version": "0.3.0",
"version": "0.3.1",
"homepage": "https://github.com/typhonjs-backbone-esnext/backbone-esnext-events",

@@ -8,2 +8,12 @@ "description": "Separates 'events' support from Backbone in addition to adding TyphonJS extensions.",

"main": "./dist/TyphonEvents",
"author": {
"name": "Mike Leahy"
},
"maintainers": [
{
"name": "Mike Leahy",
"email": "support@typhonjs.io",
"url": "https://github.com/typhonrt"
}
],
"repository": {

@@ -18,3 +28,3 @@ "type": "git",

"typhonjs-config-eslint": "^0.4.0",
"typhonjs-npm-build-test": "^0.3.0"
"typhonjs-npm-build-test": "^0.4.0"
},

@@ -30,2 +40,3 @@ "scripts": {

"files": [
".tjsdoc",
"dist",

@@ -36,3 +47,9 @@ "src",

"AUTHORS.md"
],
"keywords": [
"backbone",
"esnext",
"events",
"eventbus"
]
}

@@ -192,87 +192,2 @@ import Events from './Events.js';

* A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual
* cases speedy (most internal Backbone events have 3 arguments). This dispatch method passes back an array with
* all results returned by any invoked targets.
*
* @param {Array<*>} events - Array of stored event callback data.
* @param {Array<*>} args - Arguments supplied to `triggerSync`.
* @returns {Array<*>}
*/
const s_TRIGGER_SYNC_EVENTS = (events, args) =>
{
let ev, i = -1;
const a1 = args[0], a2 = args[1], a3 = args[2], l = events.length;
let result;
const results = [];
switch (args.length)
{
case 0:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
}
break;
case 1:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx, a1);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
}
break;
case 2:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx, a1, a2);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
}
break;
case 3:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
}
break;
default:
while (++i < l)
{
result = (ev = events[i]).callback.apply(ev.ctx, args);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
}
break;
}
// Return the results array if there are more than one or just a single result.
return results.length > 1 ? results : result;
};
/**
* A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual
* cases speedy (most internal Backbone events have 3 arguments). This dispatch method uses ES6 Promises and adds

@@ -305,6 +220,3 @@ * any returned results to an array which is added to a Promise.all construction which passes back a Promise which

// If we received a valid result add it to the promises array.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}

@@ -319,6 +231,3 @@ break;

// If we received a valid result add it to the promises array.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}

@@ -333,6 +242,3 @@ break;

// If we received a valid result add it to the promises array.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}

@@ -347,6 +253,3 @@ break;

// If we received a valid result add it to the promises array.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}

@@ -361,6 +264,3 @@ break;

// If we received a valid result add it to the promises array.
if (result !== null || typeof result !== 'undefined')
{
results.push(result);
}
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}

@@ -375,3 +275,74 @@ break;

// If there are multiple results then use Promise.all otherwise Promise.resolve.
return results.length > 1 ? Promise.all(results) : Promise.resolve(result);
};
/**
* A difficult-to-believe, but optimized internal dispatch function for triggering events. Tries to keep the usual
* cases speedy (most internal Backbone events have 3 arguments). This dispatch method synchronously passes back a
* single value or an array with all results returned by any invoked targets.
*
* @param {Array<*>} events - Array of stored event callback data.
* @param {Array<*>} args - Arguments supplied to `triggerSync`.
* @returns {*|Array<*>}
*/
const s_TRIGGER_SYNC_EVENTS = (events, args) =>
{
let ev, i = -1;
const a1 = args[0], a2 = args[1], a3 = args[2], l = events.length;
let result;
const results = [];
switch (args.length)
{
case 0:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}
break;
case 1:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx, a1);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}
break;
case 2:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx, a1, a2);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}
break;
case 3:
while (++i < l)
{
result = (ev = events[i]).callback.call(ev.ctx, a1, a2, a3);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}
break;
default:
while (++i < l)
{
result = (ev = events[i]).callback.apply(ev.ctx, args);
// If we received a valid result return immediately.
if (result !== null || typeof result !== 'undefined') { results.push(result); }
}
break;
}
// Return the results array if there are more than one or just a single result.
return results.length > 1 ? results : result;
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc