Files
companion-module-toggl-track/actions.js
Peter Daniel 3f50c7e71a beta v2
2023-06-29 12:17:31 +01:00

52 lines
893 B
JavaScript

export function updateActions() {
let actions = {}
actions['startNewTimer'] = {
name: 'Start New Timer',
options: [
{
type: 'textinput',
label: 'Description',
id: 'description',
default: '',
},
{
type: 'dropdown',
label: 'Project',
id: 'project',
default: '0',
choices: this.projects,
},
],
callback: ({ options }) => {
this.startTimer(options.project, options.description)
},
}
actions['getCurrentTimer'] = {
name: 'Get Current Timer',
options: [],
callback: (action) => {
this.getCurrentTimer()
},
}
actions['stopCurrentTimer'] = {
name: 'Stop Current Timer',
options: [],
callback: (action) => {
this.stopTimer()
},
}
actions['refreshProjects'] = {
name: 'Refresh Project List',
options: [],
callback: (action) => {
this.getWorkspace()
},
}
this.setActionDefinitions(actions)
}