separate action dispatch from server

Summary: This diff moves the first small pieces of getting device detection up and running to `server/`, and the wiring between FlipperServer and flipper core / redux is setting up specific events and dispatch actions from there.

Reviewed By: timur-valiev

Differential Revision: D30276776

fbshipit-source-id: b30b996d03c27459815bebeb97b05b5fe5d24bec
This commit is contained in:
Michel Weststrate
2021-08-13 04:01:06 -07:00
committed by Facebook GitHub Bot
parent 4909296d86
commit 6175424d16
6 changed files with 318 additions and 189 deletions

View File

@@ -0,0 +1,24 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
*/
import MacDevice from '../server/devices/MacDevice';
import WindowsDevice from '../server/devices/WindowsDevice';
import {FlipperServer} from './FlipperServer';
export default (flipperServer: FlipperServer) => {
let device;
if (process.platform === 'darwin') {
device = new MacDevice();
} else if (process.platform === 'win32') {
device = new WindowsDevice();
} else {
return;
}
flipperServer.emit('device-connected', device);
};