|
173 | 173 | }; |
174 | 174 |
|
175 | 175 | startup.globalTimeouts = function() { |
176 | | - global.setTimeout = function() { |
177 | | - var t = NativeModule.require('timers'); |
178 | | - return t.setTimeout.apply(this, arguments); |
179 | | - }; |
180 | | - |
181 | | - global.setInterval = function() { |
182 | | - var t = NativeModule.require('timers'); |
183 | | - return t.setInterval.apply(this, arguments); |
184 | | - }; |
185 | | - |
186 | | - global.clearTimeout = function() { |
187 | | - var t = NativeModule.require('timers'); |
188 | | - return t.clearTimeout.apply(this, arguments); |
189 | | - }; |
190 | | - |
191 | | - global.clearInterval = function() { |
192 | | - var t = NativeModule.require('timers'); |
193 | | - return t.clearInterval.apply(this, arguments); |
194 | | - }; |
195 | | - |
196 | | - global.setImmediate = function() { |
197 | | - var t = NativeModule.require('timers'); |
198 | | - return t.setImmediate.apply(this, arguments); |
199 | | - }; |
200 | | - |
201 | | - global.clearImmediate = function() { |
202 | | - var t = NativeModule.require('timers'); |
203 | | - return t.clearImmediate.apply(this, arguments); |
204 | | - }; |
| 176 | + const timers = NativeModule.require('timers'); |
| 177 | + global.clearImmediate = timers.clearImmediate; |
| 178 | + global.clearInterval = timers.clearInterval; |
| 179 | + global.clearTimeout = timers.clearTimeout; |
| 180 | + global.setImmediate = timers.setImmediate; |
| 181 | + global.setInterval = timers.setInterval; |
| 182 | + global.setTimeout = timers.setTimeout; |
205 | 183 | }; |
206 | 184 |
|
207 | 185 | startup.globalConsole = function() { |
|
0 commit comments