Watch (torch) web app - Screen switching off issue

My watch (torch) web app was rejected from the Galaxy Store because the screen would prematurely switch off during Samsung’s testing. However, these effects don’t happen on my watch, so I’m wondering why?

The app was built as a Web application (so I used HTML, CSS, JS) and I have enabled: tizen/privelege/power

To prevent the screen from switching off, I think the solution could be to enable: tizen/privelege/display
But this privilege is only possible for native applications (built in C / C++), any ideas on a workaround?

Here’s a snippet of the JS:

var torchBool = true;

function torch(){
    document.body.classList.toggle('white');
    if (torchBool) {
        tizen.power.request('SCREEN', 'CPU_AWAKE');
        tizen.power.setScreenBrightness(1);
        console.log(torchBool);
        return torchBool = !torchBool;
    }
    tizen.power.release('SCREEN');
    tizen.power.restoreScreenBrightness();
}

Thanks in advance!

To prevent the screen from switching off in JS, you can use Power API. Keep the screen in Normal mode and CPU in awake mode. I have modified your code snippet accordingly. Check this out:

var torchBool = true;
function torch(){
document.body.classList.toggle('white');
if (torchBool) {
    tizen.power.request('SCREEN', 'SCREEN_NORMAL');
    tizen.power.request('CPU', 'CPU_AWAKE');
    tizen.power.setScreenBrightness(1);
    console.log(torchBool);
    return torchBool = !torchBool;
}
tizen.power.release('SCREEN');
tizen.power.release('CPU');
tizen.power.restoreScreenBrightness();
}

Hey, it seems to be working. Thanks for your suggestion!