mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: replace var usage with let/const (#7064)
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Android specific timer functions implementation.
|
||||
*/
|
||||
var timeoutHandler;
|
||||
var timeoutCallbacks = {};
|
||||
var timerId = 0;
|
||||
let timeoutHandler;
|
||||
const timeoutCallbacks = {};
|
||||
let timerId = 0;
|
||||
|
||||
function createHandlerAndGetId(): number {
|
||||
if (!timeoutHandler) {
|
||||
@@ -19,7 +19,7 @@ export function setTimeout(callback: Function, milliseconds = 0, ...args): numbe
|
||||
const invoke = () => callback(...args);
|
||||
const zoneBound = zonedCallback(invoke);
|
||||
|
||||
var runnable = new java.lang.Runnable({
|
||||
const runnable = new java.lang.Runnable({
|
||||
run: () => {
|
||||
zoneBound();
|
||||
|
||||
@@ -52,7 +52,7 @@ export function setInterval(callback: Function, milliseconds = 0, ...args): numb
|
||||
const invoke = () => callback(...args);
|
||||
const zoneBound = zonedCallback(invoke);
|
||||
|
||||
var runnable = new java.lang.Runnable({
|
||||
const runnable = new java.lang.Runnable({
|
||||
run: () => {
|
||||
zoneBound();
|
||||
if (timeoutCallbacks[id]) {
|
||||
@@ -70,4 +70,4 @@ export function setInterval(callback: Function, milliseconds = 0, ...args): numb
|
||||
return id;
|
||||
}
|
||||
|
||||
export var clearInterval = clearTimeout;
|
||||
export const clearInterval = clearTimeout;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import * as utils from "../utils/utils";
|
||||
|
||||
//iOS specific timer functions implementation.
|
||||
var timeoutCallbacks = new Map<number, KeyValuePair<NSTimer, TimerTargetImpl>>();
|
||||
var timerId = 0;
|
||||
const timeoutCallbacks = new Map<number, KeyValuePair<NSTimer, TimerTargetImpl>>();
|
||||
let timerId = 0;
|
||||
|
||||
interface KeyValuePair<K, V> {
|
||||
k: K;
|
||||
@@ -80,4 +80,4 @@ export function setInterval(callback: Function, milliseconds = 0, ...args): numb
|
||||
return createTimerAndGetId(zonedCallback(invoke), milliseconds, true);
|
||||
}
|
||||
|
||||
export var clearInterval = clearTimeout;
|
||||
export const clearInterval = clearTimeout;
|
||||
|
||||
Reference in New Issue
Block a user