phoboslab / Ejecta

A Fast, Open Source JavaScript, Canvas & Audio Implementation for iOS
2.81k stars 321 forks source link

Can change "application.idleTimerDisabled = YES;" in runtime ? #270

Closed finscn closed 10 years ago

finscn commented 10 years ago

I want to set application.idleTimerDisabled via JS in ejecta. Is there a way to do it?

phoboslab commented 10 years ago

No. Try this (untested):

EJ_BIND_GET(idleTimer, ctx) {
    return JSValueMakeBoolean(ctx, [UIApplication sharedApplication].idleTimerDisabled);
}

EJ_BIND_SET(idleTimer, ctx, value) {
    [UIApplication sharedApplication].idleTimerDisabled = JSValueToBoolean(ctx, value);
}

In Ejecta, it's set to YES by default, btw.