From cf246b4bf04c998b9314be3f8ae17f605f9d447d Mon Sep 17 00:00:00 2001 From: Julian Gonggrijp Date: Tue, 10 Dec 2024 15:32:45 +0100 Subject: [PATCH] Sophisticate the fastTimeout conditional export (close #2) --- src/fastTimeout.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fastTimeout.js b/src/fastTimeout.js index 908e925..6659922 100644 --- a/src/fastTimeout.js +++ b/src/fastTimeout.js @@ -40,5 +40,6 @@ function enable() { } var hasSetImmediate = (typeof setImmediate === 'function'); +var hasPostMessage = (typeof self.postMessage === 'function'); -export default hasSetImmediate ? setImmediate : enable(); +export default hasPostMessage ? enable() : hasSetImmediate ? setImmediate : _.defer;