Skip to main content

WorkingSetSort

Import :

const WorkingSetSort = brackets.getModule("project/WorkingSetSort")

Sort

Kind: global class

new Sort(commandID, compareFn, events)

ParamTypeDescription
commandIDstringA valid command identifier.
compareFnfunctionA valid sort function (see register for a longer explanation).
eventsstringSpace-separated WorkingSetSort possible events ending with ".sort".

sort.getCommandID() ⇒ string

The Command ID

Kind: instance method of Sort

sort.getCompareFn() ⇒ function

The compare function

Kind: instance method of Sort

sort.getEvents() ⇒ string

Gets the event that this sort object is listening to

Kind: instance method of Sort

sort.setChecked(value)

Checks/Unchecks the command which will show a check in the menu

Kind: instance method of Sort

ParamType
valueboolean

sort.execute()

Performs the sort and makes it the current sort method.

Kind: instance method of Sort

sort.sort()

Only performs the working set sort if this is the current sort.

Kind: instance method of Sort

Commands

Manages the workingSetList sort methods.

Kind: global variable

get(command) ⇒ Sort

Retrieves a Sort object by id

Kind: global function

ParamTypeDescription
commandstring | CommandA command ID or a command object.

getAutomatic() ⇒ boolean

Kind: global function
Returns: boolean - Enabled state of Automatic Sort.

setAutomatic(enable)

Enables/Disables Automatic Sort depending on the value.

Kind: global function

ParamTypeDescription
enablebooleanTrue to enable, false to disable.

register(command, compareFn, events) ⇒ Sort

Registers a working set sort method.

Kind: global function

ParamTypeDescription
commandstring | CommandA command ID or a command object
compareFnfunctionThe function that will be used inside JavaScript's sort function. The return a value should be >0 (sort a to a lower index than b), =0 (leaves a and b unchanged with respect to each other) or < 0 (sort b to a lower index than a) and must always returns the same value when given a specific pair of elements a and b as its two arguments. Documentation at: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort
eventsstringOne or more space-separated event types that DocumentManger uses. Each event passed will trigger the automatic sort. If no events are passed, the automatic sort will be disabled for that sort method.