Files
Iris/src/js/services/pusher/actions.js

239 lines
3.8 KiB
JavaScript
Raw Normal View History

2016-10-27 16:58:11 +13:00
/**
* Actions and Action Creators
**/
2017-10-10 13:05:28 +13:00
export function setPort(port){
2016-10-27 16:58:11 +13:00
return {
2016-10-31 09:25:15 +13:00
type: 'PUSHER_SET_PORT',
port: port
2016-10-27 16:58:11 +13:00
}
}
export function setUsername(username, force = false){
return {
type: 'PUSHER_SET_USERNAME',
username: username.replace(/[\W_]+/g,''),
force: force
}
}
2016-10-27 16:58:11 +13:00
export function connect(){
return {
type: 'PUSHER_CONNECT'
}
}
export function disconnect(){
return {
type: 'PUSHER_DISCONNECT'
}
}
export function upgrade(){
return {
type: 'PUSHER_UPGRADE'
2018-04-16 09:01:42 +12:00
}
}
export function reload(){
2018-04-16 09:01:42 +12:00
return {
type: 'PUSHER_RELOAD'
}
}
export function restart(){
return {
type: 'PUSHER_RESTART'
}
}
2018-11-02 16:10:38 +13:00
export function localScan(){
return {
2018-11-02 16:10:38 +13:00
type: 'PUSHER_LOCAL_SCAN'
}
}
export function getConnections(){
return {
2017-02-19 21:27:43 +13:00
type: 'PUSHER_GET_CONNECTIONS'
}
}
export function connectionAdded(connection){
return {
type: 'PUSHER_CONNECTION_ADDED',
connection: connection
}
}
export function connectionChanged(connection){
return {
type: 'PUSHER_CONNECTION_CHANGED',
connection: connection
}
}
export function connectionRemoved(connection){
return {
type: 'PUSHER_CONNECTION_REMOVED',
connection: connection
}
}
2018-09-24 16:10:42 +12:00
export function request(method, params = null, response_callback = null, error_callback = null){
2016-10-27 16:58:11 +13:00
return {
2018-09-24 16:10:42 +12:00
type: 'PUSHER_REQUEST',
method: method,
params: params,
response_callback: response_callback,
error_callback: error_callback
2016-10-27 16:58:11 +13:00
}
}
export function getConfig(){
return {
type: 'PUSHER_GET_CONFIG'
}
}
export function getVersion(){
return {
type: 'PUSHER_GET_VERSION'
}
}
export function deliverBroadcast(method, params){
2017-03-09 08:04:23 +13:00
return {
type: 'PUSHER_DELIVER_BROADCAST',
data: {
method: method,
params: params
}
2017-03-09 08:04:23 +13:00
}
}
export function deliverMessage(recipient, method, params){
return {
type: 'PUSHER_DELIVER_MESSAGE',
data: {
recipient: recipient,
method: method,
params: params
}
}
}
export function getRadio(){
return {
type: 'PUSHER_GET_RADIO'
}
}
2017-10-10 13:05:28 +13:00
export function startRadio(uris){
2016-12-20 16:58:20 +13:00
return {
type: 'PUSHER_START_RADIO',
2016-12-20 16:58:20 +13:00
uris: uris
}
}
2017-10-10 13:05:28 +13:00
export function updateRadio(uris){
2017-04-18 04:44:39 +12:00
return {
type: 'PUSHER_UPDATE_RADIO',
uris: uris
}
}
2016-12-20 19:54:19 +13:00
export function stopRadio(){
2016-12-20 16:58:20 +13:00
return {
type: 'PUSHER_STOP_RADIO'
2016-12-20 16:58:20 +13:00
}
}
export function radioStarted(radio){
return {
type: 'PUSHER_RADIO_STARTED',
radio: radio
}
}
export function radioChanged(radio){
return {
type: 'PUSHER_RADIO_CHANGED',
radio: radio
}
}
export function radioStopped(){
return {
type: 'PUSHER_RADIO_STOPPED'
}
}
2017-10-10 13:05:28 +13:00
export function debug(message = null){
return {
type: 'PUSHER_DEBUG',
message: message
}
2017-02-14 12:13:07 +13:00
}
export function getQueueMetadata(){
return {
type: 'PUSHER_GET_QUEUE_METADATA'
}
}
export function queueMetadataChanged(queue_metadata){
return {
type: 'PUSHER_QUEUE_METADATA_CHANGED',
queue_metadata: queue_metadata
}
}
2017-10-10 13:05:28 +13:00
export function addQueueMetadata(tlids = [], from_uri = null){
2017-02-14 12:13:07 +13:00
return {
type: 'PUSHER_ADD_QUEUE_METADATA',
tlids: tlids,
from_uri: from_uri
}
}
2018-10-09 21:39:38 +13:00
/**
2018-10-09 21:39:38 +13:00
* Commands (buttons)
**/
2018-10-12 16:10:29 +13:00
export function getCommands(){
return {
type: 'PUSHER_GET_COMMANDS'
}
}
2018-10-09 21:39:38 +13:00
export function setCommand(command){
return {
type: 'PUSHER_SET_COMMAND',
command: command
}
2018-04-18 17:01:57 +12:00
}
2018-10-09 21:51:47 +13:00
export function removeCommand(id){
return {
type: 'PUSHER_REMOVE_COMMAND',
id: id
}
}
2018-10-12 16:10:29 +13:00
export function sendCommand(id, notify = false){
2018-10-09 21:39:38 +13:00
return {
type: 'PUSHER_SEND_COMMAND',
2018-10-12 16:10:29 +13:00
id: id,
notify: notify
2018-10-09 21:39:38 +13:00
}
2018-05-01 21:03:05 +12:00
}
2018-10-09 21:39:38 +13:00
export function commandsUpdated(commands){
return {
type: 'PUSHER_COMMANDS_UPDATED',
commands: commands
}
}