]> git.sur5r.net Git - minitube/blobdiff - lib/js/js.h
New upstream version 3.9.1
[minitube] / lib / js / js.h
index 8f0e33ade8a218eda9223e42b8166612f061cb8d..104bc4615a57999b5867a9b002af1712ece43b69 100644 (file)
@@ -18,14 +18,15 @@ public:
     auto getId() const { return id; }
 
     // This should be static but cannot bind static functions to QJSEngine
-    Q_INVOKABLE QJSValue clearTimeout(QJSValue id) {
+    Q_INVOKABLE void clearTimeout(QJSValue id) {
+        // qDebug() << "Clearing timer" << id.toString();
         auto timer = getTimers().take(id.toUInt());
         if (timer) {
             timer->stop();
             timer->deleteLater();
         } else
             qDebug() << "Unknown id" << id.toUInt();
-        return QJSValue();
+        return;
     }
     // This should be static but cannot bind static functions to QJSEngine
     Q_INVOKABLE QJSValue setTimeout(QJSValue callback, QJSValue delayTime, QJSValue args) {
@@ -57,7 +58,7 @@ public:
     }
 
     Q_INVOKABLE JSTimer(QObject *parent = nullptr) : QTimer(parent) {
-        setTimerType(Qt::CoarseTimer);
+        setTimerType(Qt::PreciseTimer);
         setSingleShot(true);
         // avoid 0
         static uint counter = 1;
@@ -87,6 +88,7 @@ public:
     QQmlEngine &getEngine() { return *engine; }
 
     JSResult &callFunction(JSResult *result, const QString &name, const QJSValueList &args);
+    void resetNAM();
 
 signals:
     void initialized();