Example #1
0
void qsKillTimer( QSEnv *env )
{
    QuickInterpreter *ip = QuickInterpreter::fromEnv(env);
    int id = (int) env->arg(0).toNumber();

    ip->timers()->remove(id);
    ip->killTimer(id);
}
Example #2
0
void qsKillTimers( QSEnv *env )
{
    QuickInterpreter *ip = QuickInterpreter::fromEnv(env);

    QHash<int, QSObject> *timers = ip->timers();
    for (QHash<int, QSObject>::ConstIterator it = timers->begin(); it != timers->end(); ++it) {
        ip->killTimer(it.key());
    }
    timers->clear();
}
Example #3
0
/*******************************************************************************
 * Timers
 */
QSObject qsStartTimer( QSEnv *env )
{
    QSObject hnd = env->arg( 1 );
    if ( hnd.isFunction() ) {
        QuickInterpreter *ip = QuickInterpreter::fromEnv(env);

        int interval = (int) env->arg(0).toNumber();
        int id = ip->startTimer(interval);

        QHash<int, QSObject> *timers = ip->timers();
        timers->insert(id, hnd);

        return env->createNumber(id);
    }

    QString msg = QString::fromLatin1("Can only install functions as event handler");
    return env->throwError( TypeError, msg );
}