createCommand

createCommand(func, canExecute)

Create a Command from a given function, for use with ViewModels.A Command is a function with an extra canExecute observable property to determinewhether the command can be executed. When executed, a Command function will check thevalue of canExecute and throw if false. It also provides events for whena command has been or is about to be executed.
Name Type Default Description
func function The function to execute.
canExecute Boolean true optional A boolean indicating whether the function can currently be executed.