Implement HeadlessClient
Reviewed By: lblasa Differential Revision: D36130082 fbshipit-source-id: 00f9709d9a4f245063ae428521031afe74a521d6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5d346b4991
commit
deaf2359b1
40
desktop/flipper-server-companion/src/HeadlessClient.tsx
Normal file
40
desktop/flipper-server-companion/src/HeadlessClient.tsx
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and 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 {ClientQuery, FlipperServer, Logger} from 'flipper-common';
|
||||
import {
|
||||
AbstractClient,
|
||||
ClientConnection,
|
||||
BaseDevice,
|
||||
} from 'flipper-frontend-core';
|
||||
import {_SandyPluginDefinition} from 'flipper-plugin';
|
||||
|
||||
export class HeadlessClient extends AbstractClient {
|
||||
constructor(
|
||||
id: string,
|
||||
query: ClientQuery,
|
||||
conn: ClientConnection | null | undefined,
|
||||
logger: Logger,
|
||||
plugins: Set<string> | null | undefined,
|
||||
device: BaseDevice,
|
||||
flipperServer: FlipperServer,
|
||||
private loadablePlugins: Map<string, _SandyPluginDefinition>,
|
||||
) {
|
||||
super(id, query, conn, logger, plugins, device, flipperServer);
|
||||
}
|
||||
|
||||
// Headless client never starts plugins automaticaly to preserve server resources
|
||||
shouldConnectAsBackgroundPlugin() {
|
||||
return false;
|
||||
}
|
||||
|
||||
async getPlugin(pluginId: string) {
|
||||
return this.loadablePlugins.get(pluginId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user