/*!
* Copyright 2017 - 2020 by ChartIQ, Inc.
* All rights reserved.
*/
import { RouterClient } from "../clients/routerClient";
import { ICentralLogger } from "../clients/logger";
import { FEAWindow } from "../FEA";
export declare type BaseClientParams = {
/** A function to be called after the client has initialized. */
onReady?: (cb: () => void) => void;
/** The name of the client. Must be unique. */
name: string;
startupDependencies?: {
services?: string[];
clients?: string[];
};
};
/**
*
Base Client
* The Base Client is inherited by every client to provide common functionality to the clients. Once all dependencies are met, either client or service, the client's `onReady` method is fired.
*
* We're currently halfway through migrating our clients from extending a normal function prototype to an ES6 class.
* "_BaseClient" represents the new class, while "BaseClient" is the original function. When the migration is complete,
* we will remove the old function and rename "_BaseClient" to "BaseClient".
* @param {Object} params
* @param {Function} params.onReady - A function to be called after the client has initialized.
* @param {String} params.name - The name of the client
@example
import { _BaseClient as BaseClient } from "./baseClient";
var NewClient = function (params) {
BaseClient.call(this, params);
var self = this;
return this;
};
var clientInstance = new NewClient({
onReady: function (cb) {
Logger.system.log("NewClient Online");
cb();
},
name:"NewClient"
});
clientInstance.initialize();
module.exports = clientInstance;
@private
*/
export declare class _BaseClient {
/** The callback called when this service is ready. */
private onReadyCallback;
private isReady;
private startupDependencies;
/** Queue of functions registered via calls to `onReady()`, invoked once the client goes online. */
private clientReadyQueue;
routerClient: typeof RouterClient;
/** Gets the current window - stays here for backward compatibility. */
finWindow?: FEAWindow;
/** Gets the current window name. */
windowName: string;
/** A unique name for the client. */
name: string;
logger: ICentralLogger;
constructor(params: BaseClientParams);
/**
* @private
*/
processClientReadyQueue: () => void;
/**
* @private
*/
onReady: (cb: () => void) => void;
/** Check to see if the client can come online. We check this against the required services and clients */
/**
* @private
*
*/
setClientOnline: () => void;
/**
* @private
*/
initialize: (cb?: () => void) => void;
/**
* @private
*/
onClose(cb?: () => void): void;
}
//# sourceMappingURL=baseClient.d.ts.map