The goog.tweak.Registry Class

goog.tweak.Registry(queryParams, compilerOverrides)

Singleton that manages all tweaks. This should be instantiated only from goog.tweak.getRegistry().

queryParams {string}
Value of window.location.search.
compilerOverrides {!Object.<string|number|boolean>}
Default value overrides set by the compiler.

.addOnRegisterListener(func)

Adds a callback to be called whenever a new tweak is added.

func {!Function}
The callback.

.extractEntries(excludeChildEntries, excludeNonSettings)

Creates and returns an array of all BaseSetting objects with an associted query parameter.

excludeChildEntries {boolean}
Exclude BooleanInGroupSettings.
excludeNonSettings {boolean}
Exclude entries that are not subclasses of BaseSetting.
returns {!Array.<!goog.tweak.BaseSetting>}
The settings.

.getBooleanSetting(id)

Returns the boolean setting with the given ID. Asserts if the ID does not refer to a registered entry or if it refers to one of the wrong type.

id {string}
The unique string that identifies this entry.
returns {!goog.tweak.BooleanSetting}
The entry.

.getEntry(id)

Returns the BaseEntry with the given ID. Asserts if it does not exists.

id {string}
The unique string that identifies this entry.
returns {!goog.tweak.BaseEntry}
The entry.

.getNumericSetting(id)

Returns the numeric setting with the given ID. Asserts if the ID does not refer to a registered entry or if it refers to one of the wrong type.

id {string}
The unique string that identifies this entry.
returns {!goog.tweak.NumericSetting}
The entry.

.getStringSetting(id)

Returns the string setting with the given ID. Asserts if the ID does not refer to a registered entry or if it refers to one of the wrong type.

id {string}
The unique string that identifies this entry.
returns {!goog.tweak.StringSetting}
The entry.

.hasEntry(id)

id {string}
The unique string that identifies this entry.
returns {boolean}
Whether a tweak with the given ID is registered.

.makeUrlQuery(opt_existingSearchStr)

Returns the query part of the URL that will apply all set tweaks.

opt_existingSearchStr {string=}
The part of the url between the ? and the #. Uses window.location.search if not given.
returns {string}
The query string.

.overrideDefaultValue(id, value)

Sets a default value to use for the given tweak instead of the one passed to the register* function. This function must be called before the tweak is registered.

id {string}
The unique string that identifies the entry.
value {string|number|boolean}
The replacement value to be used as the default value for the setting.

.parseQueryParams(queryParams)

Simple parser for query params. Makes all keys lower-case.

queryParams {string}
The part of the url between the ? and the #.
returns {!Object.<string>}
map of key->value.

.register(entry)

Registers the given tweak setting/action.

entry {goog.tweak.BaseEntry}
The entry.