Showing the changes to libraries/script-engine/src/ScriptManagerScriptingInterface.h (1 of 3 files). Show all
Unified · Split
| @@ -298,26 +298,26 @@ public: · 297 unmodified lines | ||
| 298 | 298 | * @function Script.setInterval |
| 299 | 299 | * @param {function} function - The function to call. This can be either the name of a function or an in-line definition. |
| 300 | 300 | * @param {number} interval - The interval at which to call the function, in ms. |
| 301 | − * @returns {object} A handle to the interval timer. This can be used in {@link Script.clearInterval}. | |
| 301 | + * @returns {number} A handle to the interval timer. This can be used in {@link Script.clearInterval}. | |
| 302 | 302 | * @example <caption>Print a message every second.</caption> |
| 303 | 303 | * Script.setInterval(function () { |
| 304 | 304 | * print("Interval timer fired"); |
| 305 | 305 | * }, 1000); |
| 306 | 306 | */ |
| 307 | − Q_INVOKABLE QTimer* setInterval(const ScriptValue& function, int intervalMS) { return _manager->setInterval(function, intervalMS); } | |
| 307 | + Q_INVOKABLE int setInterval(const ScriptValue& function, int intervalMS) { return _manager->setInterval(function, intervalMS); } | |
| 308 | 308 | |
| 309 | 309 | /*@jsdoc |
| 310 | 310 | * Calls a function once, after a delay. |
| 311 | 311 | * @function Script.setTimeout |
| 312 | 312 | * @param {function} function - The function to call. This can be either the name of a function or an in-line definition. |
| 313 | 313 | * @param {number} timeout - The delay after which to call the function, in ms. |
| 314 | − * @returns {object} A handle to the timeout timer. This can be used in {@link Script.clearTimeout}. | |
| 314 | + * @returns {number} A handle to the timeout timer. This can be used in {@link Script.clearTimeout}. | |
| 315 | 315 | * @example <caption>Print a message once, after a second.</caption> |
| 316 | 316 | * Script.setTimeout(function () { |
| 317 | 317 | * print("Timeout timer fired"); |
| 318 | 318 | * }, 1000); |
| 319 | 319 | */ |
| 320 | − Q_INVOKABLE QTimer* setTimeout(const ScriptValue& function, int timeoutMS) { return _manager->setTimeout(function, timeoutMS); }; | |
| 320 | + Q_INVOKABLE int setTimeout(const ScriptValue& function, int timeoutMS) { return _manager->setTimeout(function, timeoutMS); }; | |
| 321 | 321 | |
| 322 | 322 | /*@jsdoc |
| 323 | 323 | * Stops an interval timer set by {@link Script.setInterval|setInterval}. |
| @@ -335,10 +335,7 @@ public: · 11 unmodified lines | ||
| 335 | 335 | * Script.clearInterval(timer); |
| 336 | 336 | * }, 10000); |
| 337 | 337 | */ |
| 338 | − Q_INVOKABLE void clearInterval(QTimer* timer) { _manager->clearInterval(timer); } | |
| 339 | − | |
| 340 | − // Overloaded version is needed in case the timer has expired | |
| 341 | − Q_INVOKABLE void clearInterval(QVariantMap timer) { ; } | |
| 338 | + Q_INVOKABLE void clearInterval(int timer) { _manager->clearInterval(timer); } | |
| 342 | 339 | |
| 343 | 340 | /*@jsdoc |
| 344 | 341 | * Stops a timeout timer set by {@link Script.setTimeout|setTimeout}. |
| @@ -353,10 +350,7 @@ public: · 8 unmodified lines | ||
| 353 | 350 | * // Uncomment the following line to stop the timer from firing. |
| 354 | 351 | * //Script.clearTimeout(timer); |
| 355 | 352 | */ |
| 356 | − Q_INVOKABLE void clearTimeout(QTimer* timer) { _manager->clearTimeout(timer); } | |
| 357 | − | |
| 358 | − // Overloaded version is needed in case the timer has expired | |
| 359 | − Q_INVOKABLE void clearTimeout(QVariantMap timer) { ; } | |
| 353 | + Q_INVOKABLE void clearTimeout(int timer) { _manager->clearTimeout(timer); } | |
| 360 | 354 | |
| 361 | 355 | /*@jsdoc |
| 362 | 356 | * Prints a message to the program log and emits {@link Script.printedMessage}. |