From 15a48e67235474b0c953d484aec6653b392d5dc3 Mon Sep 17 00:00:00 2001 From: Atul R Date: Sat, 21 Sep 2019 23:26:58 +0200 Subject: [PATCH] cleanup --- src/demo.ts | 1 + src/lib/core/bootstrap.ts | 15 +++++++++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/demo.ts b/src/demo.ts index 320831026..36f49a667 100644 --- a/src/demo.ts +++ b/src/demo.ts @@ -41,6 +41,7 @@ checkbox.setObjectName("check"); checkbox.setChecked(true); checkbox.addEventListener(QCheckBoxEvents.toggled, () => { console.log("checkbox was toggled!"); + label1.setInlineStyle("color: green;"); }); const dial = new QDial(); diff --git a/src/lib/core/bootstrap.ts b/src/lib/core/bootstrap.ts index 6ce6a9637..ec22529d2 100644 --- a/src/lib/core/bootstrap.ts +++ b/src/lib/core/bootstrap.ts @@ -8,13 +8,16 @@ called. This is required inorder to make the timers work nicely due to merger of event loops */ -function wrapWithActivateUvLoop(func: any) { - return function() { - (process as any).activateUvLoop(); - //@ts-ignore - return func.apply(this, arguments); + +const noop = () => {}; + +const wrapWithActivateUvLoop = (func: Function) => { + return (...args: any[]) => { + const activateUvLoop = (process as any).activateUvLoop || noop; + activateUvLoop(); + return func(...args); }; -} +}; const main = () => { process.nextTick = wrapWithActivateUvLoop(process.nextTick);