-
Notifications
You must be signed in to change notification settings - Fork 0
Switches
Switches are settings with two possible values - On
and Off
.
When clicked, a switch will change to Off
if it was On
, or On
if it was Off
. Under the hood, switches are simply a special kind of toggle that have two fixed values.
Switches can be created using the switch()
function.
window.settings.switch(name, heading);
name
refers to the name of the switch. This must be a unique String
. If a setting with that name already exists, the function will return that setting instead of creating a new one.
heading
refers to the heading under which the switch will appear. This must be a String
. If a heading with that name already exists, the switch will be put under it. If no such heading exists yet, a new heading with that name will be created and the switch will be put under it.
The function returns a jQuery
value which is a reference to the switch element. This return value is usually not needed and can be ignored.
As switches are just toggles under the hood, the same event is emitted for both switches and toggles.