all files / ui/ ExecuteCommandHandler.js

28.57% Statements 2/7
0% Branches 0/4
50% Functions 1/2
33.33% Lines 2/6
1 2 3 4 5 6 7 8 9 10 11 12 13    615× 615×                  
class ExecuteCommandHandler {
  constructor(editorSession, commandName) {
    this.editorSession = editorSession
    this.commandName = commandName
  }
  execute(params) {
    let commandState = params.editorSession.getCommandStates()[this.commandName]
    if (!commandState || commandState.disabled) return false
    this.editorSession.executeCommand(this.commandName, params)
    return true
  }
}
export default ExecuteCommandHandler