WorkingSetSort
Import :
const WorkingSetSort = brackets.getModule("project/WorkingSetSort")
Sort
Kind: global class
- Sort
- new Sort(commandID, compareFn, events)
- .getCommandID() ⇒
string
- .getCompareFn() ⇒
function
- .getEvents() ⇒
string
- .setChecked(value)
- .execute()
- .sort()
new Sort(commandID, compareFn, events)
Param | Type | Description |
---|---|---|
commandID | string | A valid command identifier. |
compareFn | function | A valid sort function (see register for a longer explanation). |
events | string | Space-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
Param | Type |
---|---|
value | boolean |
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
Param | Type | Description |
---|---|---|
command | string | Command | A 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
Param | Type | Description |
---|---|---|
enable | boolean | True to enable, false to disable. |
register(command, compareFn, events) ⇒ Sort
Registers a working set sort method.
Kind: global function
Param | Type | Description |
---|---|---|
command | string | Command | A command ID or a command object |
compareFn | function | The 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 |
events | string | One 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. |