Comparing version 0.2.0 to 0.2.1
@@ -25,2 +25,4 @@ 'use strict'; | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -58,2 +60,3 @@ | ||
this.reverse = options.reverse || false; | ||
this.onceUpdate = []; | ||
this.emitter = new _eventemitter2.default(); | ||
@@ -87,8 +90,4 @@ this.status = new _Status2.default(); | ||
value: function on() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var arg = arguments.length <= 0 ? undefined : arguments[0]; | ||
var arg = args[0]; | ||
if ((typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) === 'object' && arg.constructor === Object) { | ||
@@ -101,3 +100,5 @@ for (var key in arg) { | ||
} else { | ||
this.emitter.on.apply(this.emitter, args); | ||
var _emitter; | ||
(_emitter = this.emitter).on.apply(_emitter, arguments); | ||
} | ||
@@ -110,4 +111,4 @@ | ||
value: function once() { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
@@ -120,7 +121,15 @@ | ||
if (arg.hasOwnProperty(key)) { | ||
this.emitter.once(key, arg[key]); | ||
this.emitter[key === 'update' ? 'on' : 'once'](key, arg[key]); | ||
if (key === 'update') { | ||
this.onceUpdate.push([key, arg[key]]); | ||
} | ||
} | ||
} | ||
} else { | ||
this.emitter.once.apply(this.emitter, args); | ||
var _emitter2; | ||
(_emitter2 = this.emitter)[arg === 'update' ? 'on' : 'once'].apply(_emitter2, args); | ||
if (arg === 'update') { | ||
this.onceUpdate.push(args); | ||
} | ||
} | ||
@@ -133,10 +142,8 @@ | ||
value: function off() { | ||
for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
} | ||
if (args.length === 0) { | ||
if (arguments.length === 0) { | ||
this.emitter.removeAllListeners(); | ||
} else { | ||
this.emitter.off.apply(this.emitter, args); | ||
var _emitter3; | ||
(_emitter3 = this.emitter).off.apply(_emitter3, arguments); | ||
} | ||
@@ -168,4 +175,6 @@ | ||
if (pastTime >= duration) { | ||
_this.emitter.emit.apply(_this.emitter, ['update'].concat(blend(1))); | ||
var _emitter4; | ||
(_emitter4 = _this.emitter).emit.apply(_emitter4, _toConsumableArray(['update'].concat(blend(1)))); | ||
if (_this.loop) { | ||
@@ -178,6 +187,13 @@ startTime = timestamp; | ||
_this.emitter.emit('done'); | ||
if (_this.onceUpdate.length > 0) { | ||
for (var i = 0, n = _this.onceUpdate.length; i < n; i++) { | ||
_this.off.apply(_this, _toConsumableArray(_this.onceUpdate.pop())); | ||
} | ||
} | ||
return; | ||
} | ||
} else { | ||
_this.emitter.emit.apply(_this.emitter, ['update'].concat(blend(progress))); | ||
var _emitter5; | ||
(_emitter5 = _this.emitter).emit.apply(_emitter5, _toConsumableArray(['update'].concat(blend(progress)))); | ||
} | ||
@@ -184,0 +200,0 @@ |
{ | ||
"name": "stepperjs", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A tiny requestAnimationFrame wrapper to improve usability.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -84,3 +84,3 @@ # StepperJS | ||
```html | ||
<script type="text/javascript" src="stepperjs.browser-0.2.0.min.js"></script> | ||
<script type="text/javascript" src="stepperjs.browser-0.2.1.min.js"></script> | ||
``` | ||
@@ -87,0 +87,0 @@ |
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
149618
1970