Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Example UsageArgumentsReturn Value
ts.theme(x);

x - undefined or a string of the name of theme you want to set the current theme to

if x is undefined - a string of the name of the current theme

if x is a string - no return value

toggleTheme

Toggle the current theme to the next theme in the theme list. Currently it toggles between the 'light' and 'dark' themes (see above).

Example UsageArgumentsReturn Value
ts.toggleTheme();nonethe current theme that it was toggled to as a string

addListener

Add a listener to a theme event. Currently, the only theme event is "themeChange".

Example UsageArgumentsReturn Value
ts.addListener(callback);

callback - function reference to be executed on a theme event. The function is passed an object containing:

event: 'themeChange',

value: <the current theme as a string>

removeListener

 

 

 

 

 

...

An object containing:

id: Number of which listener ID this is

cb: callback

error: 'No callback defined' (if there was a problem)

removeListener

Remove a theme event listener.

Example UsageArgumentsReturn Value
ts.removeListener(lsnr);lsnr - the object that was returned from addListenernone, but removes the listener and callback from the themeChange event