Join MDN and developers like you at Mozilla's View Source conference, 12-14 September in Berlin, Germany. Learn more at https://viewsourceconf.org

FMRadio.enable()

This API is available on Firefox or Firefox OS for installed or higher privileged applications.

Summary

The enable method is used to turns on the radio on the given frequency.

This function will throw an error if it is called with no argument.

Each time this method is called successfully, the enabled event and the frequencychange event are fired.

Syntax

var request = instanceOfFMRadio.enable(frequency);

Parameters

frenquency
The value of the frenquency the radio should listen to.

Returns

It returns a DOMRequest to handle the success or error of the operation.

Example

var request = navigator.mozFMRadio.enable(100.0);
 
request.onsuccess = function () {
  console.log("The radio is enable");
}

request.onerror = function () {
  console.log("Something goes wrong!");
}

Specification

Not part of any specification.

See also

Document Tags and Contributors

 Contributors to this page: chrisdavidmills, teoli, kscarfone, Jeremie
 Last updated by: chrisdavidmills,