ScheduleController(registry)

new ScheduleController(registry)

Parameters:
Name Type Description
registry Registry

Methods

action(id)

Call an action This method is called from within a plugin and sends the id, the scheduler determines what should then happen
Parameters:
Name Type Description
id number

cleanConfig(config) → {Object}

Cleans the configuration to store in the database
Parameters:
Name Type Description
config Object
Returns:
Object

eventLoadType(event) → {Object}

Loads plugin based parameters These parameters are dynamic and aren't stored to the database, but are needed for the front end. For example, the configuration description.
Parameters:
Name Type Description
event Object
Returns:
Object - Event object with plugin passed params

eventWatch(config, add)

Register or unregister an event from being watched
Parameters:
Name Type Default Description
config Object
add boolean true Add or remove the event from the watch schedule

findEventIndex(id) → {number}

Get event index from an event ID
Parameters:
Name Type Description
id number
Returns:
number

protected getBankButton(button) → {Array.<number>}

Get the bank and button number from a string
Parameters:
Name Type Description
button string
Returns:
Array.<number>

protected getNextId() → {number}

Get the next unique event ID
Returns:
number

getPlugin(type)nullable {Object}

Gets the plugin from a request type
Parameters:
Name Type Description
type string
Returns:
Object

getSchedule(socket, cb)

Sends the event list to the callback
Parameters:
Name Type Description
socket SocketIO
cb scheduleGetCb

initConfig()

Initialize the configuration and start any schedules

loadPlugins()

Loads plugins from the schedule plugin directory

saveSchedule(socket, newData, cb)

Replaced an event configuration
Parameters:
Name Type Description
socket SocketIO
newData Object
cb scheduleSaveCb

saveToDb()

Saves to database

sendPlugins(socket, cb)

Parameters:
Name Type Description
socket SocketIO
cb pluginCallback

startSchedule()

Starts all event schedules

updateSchedule(socket, id, newData, cb)

Updates a schedule Minor updates and deletions
Parameters:
Name Type Description
socket SocketIO
id number Event ID
newData Object If deleted property is set, event is deleted
cb scheduleUpdateCb