Module: ko/prefs

The prefs SDK allows you to access Komodo's preferences, it returns an instance of PreferenceSet

Example

var prefs = require("ko/prefs"); // returns global preference set.
Author:
  • ActiveState
License:
  • Mozilla Public License v. 2.0

Methods


require("ko/prefs").file()

Return the current files prefs Falls back to project level if there is no file open Then Falls back to global level if there is no project open

Returns:

Returns ko/prefs instance for the current file

Type
module:ko/prefs

require("ko/prefs").project()

Return the current projects prefs Falls back to global if there is no project open

Returns:

Returns ko/prefs instance for the current project

Type
module:ko/prefs

require("ko/prefs").registerCategory(name, path, insertAt, position)

Register a preference set to be displayed in the prefs window

Parameters:
Name Type Description
name String

The preference name that will be displayed in the preferences window

path String

The chrome path to your *.xul file

insertAt String

ID of the element to insert

position String

Where to insert this element, can be one of "after" and "child"


require("ko/prefs").getBoolean(name, default)

Get a boolean preference, defaults to false

Parameters:
Name Type Description
name String

The preference name

default Boolean

The default to return if the pref was not set

Returns:
Type
Boolean

require("ko/prefs").getLong(name, default)

Get a long (integer) preference, defaults to 0

Parameters:
Name Type Description
name String

The preference name

default Long

The default to return if the pref was not set

Returns:
Type
Long

require("ko/prefs").getPref(name)

Get a child prefset

Parameters:
Name Type Description
name String

The preference name

Returns:
Type
prefset

require("ko/prefs").getString(name, default)

Get a string preference, defaults to an empty string

Parameters:
Name Type Description
name String

The preference name

default String

The default to return if the pref was not set

Returns:
Type
String

require("ko/prefs").hasPref(name)

Check if the preference exists (is defined)

Parameters:
Name Type Description
name String

The preference name

Returns:
Type
Boolean

require("ko/prefs").hasPrefHere(name)

Check if the preference exists (is defined) on the current scope (not the parent scopes)

Parameters:
Name Type Description
name String

The preference name

Returns:
Type
Boolean

require("ko/prefs").onChange(name, callback)

Handle change event for a pref

Parameters:
Name Type Description
name String

The preference name

callback function
Returns:
Type
void

require("ko/prefs").removeOnChange(name, callback)

Remove a callback handler for a pref change event

Parameters:
Name Type Description
name String

The preference name

callback function
Returns:
Type
void

require("ko/prefs").setBoolean(name, value)

Set a boolean preference

Parameters:
Name Type Description
name String

The preference name

value Boolean

The preference value

Returns:
Type
Boolean

require("ko/prefs").setLong(name, value)

Set a long (integer) preference

Parameters:
Name Type Description
name String

The preference name

value Long

The preference value

Returns:
Type
Long

require("ko/prefs").setPref(name, value)

Set a prefset value

Parameters:
Name Type Description
name String

The preference name

value prefset

The preference value

Returns:
Type
void

require("ko/prefs").setString(name, value)

Set a string preference

Parameters:
Name Type Description
name String

The preference name

value String

The preference value