Skip to content
Snippets Groups Projects
actions.js 2.04 KiB
Newer Older
  • Learn to ignore specific revisions
  • Tobias Ullerich's avatar
    Tobias Ullerich committed
    module.exports = function (self) {
    
        self.setActionDefinitions({
    
            pad_trigger_action: {
    
                name: 'Trigger Pad',
                options: [
                    {
    
                        id: 'name',
                        type: 'textinput',
                        label: 'Pad Name',
                        default: '',
    
                    },
                ],
                callback: async (event) => {
    
                    const pad = self.currentProject.findPadByName(event.options.name);
                    if (!pad) {
                        self.log('warning', 'Cannot find a pad with name ' + event.options.name);
    
                    self.sendToWebSocket('cart-action', {
    
            page_action: {
                name: 'Set Page',
                options: [
                    {
                        id: 'page',
                        type: 'number',
                        label: 'Page Number',
                        default: '',
                    },
                ],
                callback: async (event) => {
                    self.sendToWebSocket('page-action', {
                        'page': event.options.page - 1
                    });
                },
            },
            navigate_action: {
                name: 'Navigate',
                options: [
                    {
                        id: 'type',
                        type: 'dropdown',
                        choices: [
                            { id: 'PREVIOUS', label: 'Previous' },
                            { id: 'NEXT', label: 'Next' }
                        ],
                        label: 'Action',
                        default: '',
                    },
                ],
                callback: async (event) => {
                    self.sendToWebSocket('navigate-action', {
                        'action': event.options.type
                    });
                },
    
            },
            stop_action: {
                name: 'Stop All',
                options: [],
                callback: async (event) => {
                    self.sendToWebSocket('stop-action', {});
                },
    
    Tobias Ullerich's avatar
    Tobias Ullerich committed
    }