From 56f42c654bd8912b795131e92c5fc773c8c49634 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Mon, 13 Jul 2015 17:21:21 +0300 Subject: [PATCH 1/3] Move _applyXmlAttribute outside @private block. Fixes a broken interface implementation error in the public d.ts. --- ui/core/view.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ui/core/view.d.ts b/ui/core/view.d.ts index b2011359a..e8186db56 100644 --- a/ui/core/view.d.ts +++ b/ui/core/view.d.ts @@ -412,6 +412,8 @@ declare module "ui/core/view" { _removeView(view: View); _context: android.content.Context; + public _applyXmlAttribute(attribute: string, value: any): boolean; + // TODO: Implement logic for stripping these lines out //@private _gestureObservers: Map>; @@ -441,7 +443,6 @@ declare module "ui/core/view" { _updateLayout(): void; - _applyXmlAttribute(attribute, value): boolean; /** * Called my measure method to cache measureSpecs. @@ -519,4 +520,4 @@ declare module "ui/core/view" { */ _applyXmlAttribute(attributeName: string, attrValue: any): boolean; } -} \ No newline at end of file +} From aec5e8b468720838eb0a5189707552886d83c852 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Tue, 14 Jul 2015 14:49:16 +0300 Subject: [PATCH 2/3] Fix timer id generation -- we shouldn't have clashing id's anymore. --- timer/timer.android.ts | 18 ++++++++++-------- timer/timer.ios.ts | 8 +++++--- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/timer/timer.android.ts b/timer/timer.android.ts index 7a674b970..b14e3e33e 100644 --- a/timer/timer.android.ts +++ b/timer/timer.android.ts @@ -3,24 +3,26 @@ */ var timeoutHandler; var timeoutCallbacks = {}; +var timerId = 0; -function createHadlerAndGetId(): number { +function createHandlerAndGetId(): number { if (!timeoutHandler) { timeoutHandler = new android.os.Handler(android.os.Looper.getMainLooper()); } - return new Date().getUTCMilliseconds(); + timerId++; + return timerId; } export function setTimeout(callback: Function, milliseconds = 0): number { - var id = createHadlerAndGetId(); + var id = createHandlerAndGetId(); var runnable = new java.lang.Runnable({ run: () => { callback(); - if (timeoutCallbacks && timeoutCallbacks[id]) { - timeoutCallbacks[id] = null; + if (timeoutCallbacks[id]) { + delete timeoutCallbacks[id]; } } }); @@ -37,12 +39,12 @@ export function setTimeout(callback: Function, milliseconds = 0): number { export function clearTimeout(id: number): void { if (timeoutCallbacks[id]) { timeoutHandler.removeCallbacks(timeoutCallbacks[id]); - timeoutCallbacks[id] = null; + delete timeoutCallbacks[id]; } } export function setInterval(callback: Function, milliseconds = 0): number { - var id = createHadlerAndGetId(); + var id = createHandlerAndGetId(); var handler = timeoutHandler; var runnable = new java.lang.Runnable({ @@ -61,4 +63,4 @@ export function setInterval(callback: Function, milliseconds = 0): number { return id; } -export var clearInterval = clearTimeout; \ No newline at end of file +export var clearInterval = clearTimeout; diff --git a/timer/timer.ios.ts b/timer/timer.ios.ts index f62d1fedc..aadd91b32 100644 --- a/timer/timer.ios.ts +++ b/timer/timer.ios.ts @@ -2,6 +2,7 @@ * iOS specific timer functions implementation. */ var timeoutCallbacks = {}; +var timerId = 0; class TimerTargetImpl extends NSObject { static new(): TimerTargetImpl { @@ -25,7 +26,8 @@ class TimerTargetImpl extends NSObject { } function createTimerAndGetId(callback: Function, milliseconds: number, shouldRepeat: boolean): number { - var id = new Date().getUTCMilliseconds(); + timerId++; + var id = timerId; var timerTarget = TimerTargetImpl.new().initWithCallback(callback); var timer = NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(milliseconds / 1000, timerTarget, "tick", null, shouldRepeat); @@ -44,7 +46,7 @@ export function setTimeout(callback: Function, milliseconds = 0): number { export function clearTimeout(id: number): void { if (timeoutCallbacks[id]) { timeoutCallbacks[id].invalidate(); - timeoutCallbacks[id] = null; + delete timeoutCallbacks[id]; } } @@ -52,4 +54,4 @@ export function setInterval(callback: Function, milliseconds = 0): number { return createTimerAndGetId(callback, milliseconds, true); } -export var clearInterval = clearTimeout; \ No newline at end of file +export var clearInterval = clearTimeout; From dedf0615b923f664b5eff5d56e870c8303df2684 Mon Sep 17 00:00:00 2001 From: Hristo Deshev Date: Tue, 14 Jul 2015 18:17:58 +0300 Subject: [PATCH 3/3] Fix tslint error. --- ui/core/view.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/core/view.d.ts b/ui/core/view.d.ts index e8186db56..9865dca8e 100644 --- a/ui/core/view.d.ts +++ b/ui/core/view.d.ts @@ -443,7 +443,6 @@ declare module "ui/core/view" { _updateLayout(): void; - /** * Called my measure method to cache measureSpecs. */