# lighton()

Syntax:

    [void] sysinfo.lighton(Int lighttarget, Int duration, Int intensity, Bool fadein)

Description:

The `lighton` method switches the specified target light on for a specified duration with the brightness defined by a specified light intensity.

Argument:

- `lighttarget`:

  Defines which target light should be turned on. Use one of the supported target light properties to specify a target light.

- `duration`:

  Defines the period during which the target light is switched on. The period is measured in milliseconds.

  After the duration expires, the light state of the target will be changed to whatever state was caused by the last infinite time duration call. If there has not been a previous infinite time duration call in a session, the default state determined by the inactivity timer (system backlight timeout) is used.

  If `duration` is `lightinfiniteduration`, the target light can be turned off only when some other light control method is called.

  Duration can also have the maximum value of `lightmaxduration`

- `intensity`:

  Defines the intensity (brightness) of the light. If `intensity` is `lightdefaultintensity`, the device default intensity will be used.

  Use the `lightminintensity` and the `lightmaxintensity` to detect the range of supported light intensity, and use any value between the range to avoid providing an invalid intensity value.

Note: All devices might not support a user-defined intensity, in which case the device will behave in its default manner.

- `fadein`:

  If `true`, target lights will not turn on instantly but fade-in smoothly instead. if `false`, target lights will be turned on without the fading effect.

Note: All devices might not support fade-in, in which case the device will behave in its default manner.

Return value:

This method does not return a value.

Remarks:

Switching and keeping the mobile device lights on consumes energy. Therefore, it is recommended that you carefully consider the need for using the lights.

Example code:

    function callLightOn()
    {
       // get the Embed element reference
       var sysinfo = document.embeds[0];
       /*********************
       call lighton() method, which turns on the light
       of all displays and keyboard with the maximum duration
       and using the default light intensity with the fade-in
       effect
       *********************/
       var target =  sysinfo.lighttargetsystem;
       var duration = sysinfo.lightmaxduration;
       var intensity = sysinfo.lightdefaultintensity;
       sysinfo.lighton(target, duration, intensity, true);
    }