blob: 50b394dda8d580531c3a9e48473d6a16cbf59857 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#ifndef JSKITTIMER_P_H
#define JSKITTIMER_P_H
#include <QLoggingCategory>
#include <QJSValue>
#include <QJSEngine>
class JSKitTimer : public QObject
{
Q_OBJECT
QLoggingCategory l;
public:
explicit JSKitTimer(QJSEngine *engine);
Q_INVOKABLE int setInterval(QJSValue expression, int delay);
Q_INVOKABLE void clearInterval(int timerId);
Q_INVOKABLE int setTimeout(QJSValue expression, int delay);
Q_INVOKABLE void clearTimeout(int timerId);
protected:
void timerEvent(QTimerEvent *event);
private:
QJSEngine *m_engine;
QHash<int, QJSValue> m_intervals;
QHash<int, QJSValue> m_timeouts;
};
#endif // JSKITTIMER_P_H
|