core-decorators
Advanced tools
Comparing version 0.9.1 to 0.9.2
@@ -27,3 +27,3 @@ 'use strict'; | ||
var keys = ['value', 'get', 'set']; | ||
var keys = ['value', 'initializer', 'get', 'set']; | ||
@@ -54,3 +54,3 @@ for (var i = 0, l = keys.length; i < l; i++) { | ||
this.throttleTimeoutIds = {}; | ||
this.throttlePreviouStimestamps = {}; | ||
this.throttlePreviousTimestamps = {}; | ||
}; | ||
@@ -57,0 +57,0 @@ |
@@ -46,7 +46,7 @@ 'use strict'; | ||
var throttleTimeoutIds = _metaFor.throttleTimeoutIds; | ||
var throttlePreviouStimestamps = _metaFor.throttlePreviouStimestamps; | ||
var throttlePreviousTimestamps = _metaFor.throttlePreviousTimestamps; | ||
var timeout = throttleTimeoutIds[key]; | ||
// last execute timestamp | ||
var previous = throttlePreviouStimestamps[key] || 0; | ||
var previous = throttlePreviousTimestamps[key] || 0; | ||
var now = Date.now(); | ||
@@ -66,7 +66,7 @@ var args = arguments; | ||
delete throttleTimeoutIds[key]; | ||
throttlePreviouStimestamps[key] = now; | ||
throttlePreviousTimestamps[key] = now; | ||
callback.apply(this, args); | ||
} else if (!timeout && options.trailing !== false) { | ||
throttleTimeoutIds[key] = setTimeout(function () { | ||
throttlePreviouStimestamps[key] = options.leading === false ? 0 : Date.now(); | ||
throttlePreviousTimestamps[key] = options.leading === false ? 0 : Date.now(); | ||
delete throttleTimeoutIds[key]; | ||
@@ -73,0 +73,0 @@ callback.apply(_this, args); |
{ | ||
"name": "core-decorators", | ||
"version": "0.9.1", | ||
"version": "0.9.2", | ||
"description": "Library of ES2016 (ES7) JavaScript decorators inspired by languages that come with built-ins like @override, @deprecate, @autobind, @mixin and more! Works great with React/Angular/more!", | ||
@@ -46,3 +46,5 @@ "main": "lib/core-decorators.js", | ||
"babel": "^5.4.7", | ||
"camelcase": "^2.0.1", | ||
"chai": "^3.2.0", | ||
"glob": "^6.0.1", | ||
"mocha": "^2.2.5", | ||
@@ -49,0 +51,0 @@ "sinon": "^1.15.4", |
@@ -9,3 +9,3 @@ const { defineProperty, getOwnPropertyDescriptor, | ||
const keys = ['value', 'get', 'set']; | ||
const keys = ['value', 'initializer', 'get', 'set']; | ||
@@ -34,3 +34,3 @@ for (let i = 0, l = keys.length; i < l; i++) { | ||
throttleTimeoutIds = {}; | ||
throttlePreviouStimestamps = {}; | ||
throttlePreviousTimestamps = {}; | ||
} | ||
@@ -37,0 +37,0 @@ |
@@ -23,6 +23,6 @@ import { decorate, metaFor } from './private/utils'; | ||
value() { | ||
const { throttleTimeoutIds, throttlePreviouStimestamps } = metaFor(this); | ||
const { throttleTimeoutIds, throttlePreviousTimestamps } = metaFor(this); | ||
const timeout = throttleTimeoutIds[key]; | ||
// last execute timestamp | ||
let previous = throttlePreviouStimestamps[key] || 0; | ||
let previous = throttlePreviousTimestamps[key] || 0; | ||
const now = Date.now(); | ||
@@ -42,7 +42,7 @@ const args = arguments; | ||
delete throttleTimeoutIds[key]; | ||
throttlePreviouStimestamps[key] = now; | ||
throttlePreviousTimestamps[key] = now; | ||
callback.apply(this, args); | ||
} else if (!timeout && options.trailing !== false) { | ||
throttleTimeoutIds[key] = setTimeout(() => { | ||
throttlePreviouStimestamps[key] = options.leading === false ? 0 : Date.now(); | ||
throttlePreviousTimestamps[key] = options.leading === false ? 0 : Date.now(); | ||
delete throttleTimeoutIds[key]; | ||
@@ -49,0 +49,0 @@ callback.apply(this, args); |
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
75276
7