mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Avoid issues with Titanium, clearTimeout, and an undefined timer id.
Former-commit-id: 18813fcebbab5185164c236a647b0b6436d495ff
This commit is contained in:
6
build.js
6
build.js
@@ -2210,7 +2210,7 @@
|
|||||||
' var args,',
|
' var args,',
|
||||||
' result,',
|
' result,',
|
||||||
' thisArg,',
|
' thisArg,',
|
||||||
' timeoutId;',
|
' timeoutId = null;',
|
||||||
'',
|
'',
|
||||||
' function delayed() {',
|
' function delayed() {',
|
||||||
' timeoutId = null;',
|
' timeoutId = null;',
|
||||||
@@ -2567,8 +2567,8 @@
|
|||||||
' var args,',
|
' var args,',
|
||||||
' result,',
|
' result,',
|
||||||
' thisArg,',
|
' thisArg,',
|
||||||
' timeoutId,',
|
' lastCalled = 0,',
|
||||||
' lastCalled = 0;',
|
' timeoutId = null;',
|
||||||
'',
|
'',
|
||||||
' function trailingCall() {',
|
' function trailingCall() {',
|
||||||
' lastCalled = new Date;',
|
' lastCalled = new Date;',
|
||||||
|
|||||||
@@ -4639,8 +4639,8 @@
|
|||||||
var args,
|
var args,
|
||||||
result,
|
result,
|
||||||
thisArg,
|
thisArg,
|
||||||
timeoutId,
|
|
||||||
callCount = 0,
|
callCount = 0,
|
||||||
|
timeoutId = null,
|
||||||
trailing = true;
|
trailing = true;
|
||||||
|
|
||||||
function delayed() {
|
function delayed() {
|
||||||
@@ -4660,6 +4660,9 @@
|
|||||||
return function() {
|
return function() {
|
||||||
args = arguments;
|
args = arguments;
|
||||||
thisArg = this;
|
thisArg = this;
|
||||||
|
|
||||||
|
// avoid issues with Titanium and `undefined` timeout ids
|
||||||
|
// https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
|
|
||||||
if (leading && ++callCount < 2) {
|
if (leading && ++callCount < 2) {
|
||||||
@@ -4868,9 +4871,9 @@
|
|||||||
var args,
|
var args,
|
||||||
result,
|
result,
|
||||||
thisArg,
|
thisArg,
|
||||||
timeoutId,
|
|
||||||
lastCalled = 0,
|
lastCalled = 0,
|
||||||
leading = true,
|
leading = true,
|
||||||
|
timeoutId = null,
|
||||||
trailing = true;
|
trailing = true;
|
||||||
|
|
||||||
function trailingCall() {
|
function trailingCall() {
|
||||||
|
|||||||
Reference in New Issue
Block a user