From bb2ced764938c4aa6b4e003b7dedb26c8a096b97 Mon Sep 17 00:00:00 2001 From: Victor Chabbert Date: Sun, 28 May 2017 23:39:12 +0200 Subject: Initial type checking work with flowtype --- frontend/src/utils/websocket.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'frontend/src/utils') diff --git a/frontend/src/utils/websocket.js b/frontend/src/utils/websocket.js index b33b2d50..2751b16c 100644 --- a/frontend/src/utils/websocket.js +++ b/frontend/src/utils/websocket.js @@ -1,10 +1,11 @@ +// @flow import SockJS from 'sockjs-client'; import Stomp from 'webstomp-client'; import { eventChannel } from 'redux-saga'; const wsURL = '/seven-wonders-websocket'; -export const createWsConnection = (headers = {}) => +export const createWsConnection = (headers: Object = {}) => new Promise((resolve, reject) => { let socket = Stomp.over(new SockJS(wsURL), { debug: process.env.NODE_ENV !== 'production', @@ -12,7 +13,7 @@ export const createWsConnection = (headers = {}) => socket.connect(headers, frame => resolve({ frame, socket }), reject); }); -export const createSubscriptionChannel = (socket, path) => { +export const createSubscriptionChannel = (socket: any, path: string) => { return eventChannel(emitter => { const socketSubscription = socket.subscribe(path, event => { emitter(JSON.parse(event.body)); -- cgit