riot-observable
Advanced tools
Comparing version 2.3.0-beta.2 to 2.3.0-beta.3
{ | ||
"name": "riot-observable", | ||
"main": "index.js", | ||
"main": "dist/observable.js", | ||
"homepage": "https://github.com/riot/observable", | ||
@@ -5,0 +5,0 @@ "authors": ["Muut, Inc. and other contributors"], |
@@ -75,3 +75,12 @@ ;(function(window, undefined) {var observable = function(el) { | ||
el.off(events, on) | ||
fn.apply(el, arguments) | ||
// V8 performance optimization | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments | ||
var arglen = arguments.length | ||
var args = new Array(arglen) | ||
for (var i = 0; i < arglen; i++) { | ||
args[i] = arguments[i] | ||
} | ||
fn.apply(el, args) | ||
} | ||
@@ -88,3 +97,9 @@ return el.on(events, on) | ||
defineProperty('trigger', function(events) { | ||
var args = [].slice.call(arguments, 1) | ||
// V8 performance optimization | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments | ||
var arglen = arguments.length - 1 | ||
var args = new Array(arglen) | ||
for (var i = 0; i < arglen; i++) { | ||
args[i] = arguments[i + 1] // skip first argument | ||
} | ||
@@ -96,10 +111,5 @@ onEachEvent(events, function(name) { | ||
for (var i = 0, fn; fn = fns[i]; ++i) { | ||
if (fn.busy) return | ||
fn.busy = 1 | ||
// avoid that this fn.busy gets stuck in case of errors it fixes #3 | ||
try { | ||
fn.apply(el, fn.typed ? [name].concat(args) : args) | ||
} catch (e) { /* error */} | ||
if (fns[i] !== fn) { i-- } | ||
fn.busy = 0 | ||
fn.apply(el, fn.typed ? [name].concat(args) : args) | ||
} | ||
@@ -106,0 +116,0 @@ |
@@ -75,3 +75,12 @@ riot.observable = function(el) { | ||
el.off(events, on) | ||
fn.apply(el, arguments) | ||
// V8 performance optimization | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments | ||
var arglen = arguments.length | ||
var args = new Array(arglen) | ||
for (var i = 0; i < arglen; i++) { | ||
args[i] = arguments[i] | ||
} | ||
fn.apply(el, args) | ||
} | ||
@@ -88,3 +97,9 @@ return el.on(events, on) | ||
defineProperty('trigger', function(events) { | ||
var args = [].slice.call(arguments, 1) | ||
// V8 performance optimization | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments | ||
var arglen = arguments.length - 1 | ||
var args = new Array(arglen) | ||
for (var i = 0; i < arglen; i++) { | ||
args[i] = arguments[i + 1] // skip first argument | ||
} | ||
@@ -96,10 +111,5 @@ onEachEvent(events, function(name) { | ||
for (var i = 0, fn; fn = fns[i]; ++i) { | ||
if (fn.busy) return | ||
fn.busy = 1 | ||
// avoid that this fn.busy gets stuck in case of errors it fixes #3 | ||
try { | ||
fn.apply(el, fn.typed ? [name].concat(args) : args) | ||
} catch (e) { /* error */} | ||
if (fns[i] !== fn) { i-- } | ||
fn.busy = 0 | ||
fn.apply(el, fn.typed ? [name].concat(args) : args) | ||
} | ||
@@ -106,0 +116,0 @@ |
@@ -75,3 +75,12 @@ var observable = function(el) { | ||
el.off(events, on) | ||
fn.apply(el, arguments) | ||
// V8 performance optimization | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments | ||
var arglen = arguments.length | ||
var args = new Array(arglen) | ||
for (var i = 0; i < arglen; i++) { | ||
args[i] = arguments[i] | ||
} | ||
fn.apply(el, args) | ||
} | ||
@@ -88,3 +97,9 @@ return el.on(events, on) | ||
defineProperty('trigger', function(events) { | ||
var args = [].slice.call(arguments, 1) | ||
// V8 performance optimization | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#3-managing-arguments | ||
var arglen = arguments.length - 1 | ||
var args = new Array(arglen) | ||
for (var i = 0; i < arglen; i++) { | ||
args[i] = arguments[i + 1] // skip first argument | ||
} | ||
@@ -99,2 +114,4 @@ onEachEvent(events, function(name) { | ||
// avoid that this fn.busy gets stuck in case of errors it fixes #3 | ||
// TODO: try/catch should be removed | ||
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#2-unsupported-syntax | ||
try { | ||
@@ -101,0 +118,0 @@ fn.apply(el, fn.typed ? [name].concat(args) : args) |
{ | ||
"name": "riot-observable", | ||
"version": "2.3.0-beta.2", | ||
"version": "2.3.0-beta.3", | ||
"description": "Simple script to send and receive events", | ||
@@ -23,5 +23,5 @@ "main": "dist/observable.js", | ||
"coveralls": "^2.11.4", | ||
"eslint": "^1.4.1", | ||
"eslint": "^1.5.1", | ||
"expect.js": "^0.3.1", | ||
"karma": "^0.13.9", | ||
"karma": "^0.13.10", | ||
"karma-coverage": "^0.5.2", | ||
@@ -28,0 +28,0 @@ "karma-mocha": "^0.2.0", |
@@ -21,3 +21,3 @@ module.exports = function(config) { | ||
reporters: ['progress', 'saucelabs', 'coverage'], | ||
reporters: ['progress', 'coverage'], | ||
preprocessors: { | ||
@@ -24,0 +24,0 @@ '../index.js': ['coverage'] |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43509
621