import { i as TypedClientSocket, t as NodeCG } from "../../nodecg.js"; import { n as AbstractReplicant, r as ReplicantValue } from "../../replicants.shared.js"; import "../../logger-interface.js"; import { n as NodeCGAPIBase } from "../../api.base.js"; import { DeepReadonly } from "ts-essentials"; //#region src/client/api/config.d.ts declare const filteredConfig: NodeCG.FilteredConfig; //#endregion //#region src/client/api/replicant.d.ts declare class ClientReplicant = NodeCG.Replicant.Options> extends AbstractReplicant<"client", V, O> { value: ReplicantValue<"client", V, O>; /** * When running in the browser, we have to wait until the socket joins the room * and the replicant is fully declared before running any additional commands. * After this time, commands do not need to be added to the queue and are simply executed immediately. */ private _actionQueue; private readonly _socket; constructor(name: string, namespace: string, opts: O, socket?: TypedClientSocket); /** * A map of all Replicants declared in this context. Top-level keys are namespaces, * child keys are Replicant names. */ static get declaredReplicants(): Record>>; /** * Adds an operation to the operation queue, to be flushed at the end of the current tick. * @param path {string} - The object path to where this operation took place. * @param method {string} - The name of the operation. * @param args {array} - The arguments provided to this operation * @private */ _addOperation(operation: NodeCG.Replicant.Operation>): void; /** * Emits all queued operations via Socket.IO & empties this._operationQueue. * @private */ _flushOperations(): void; /** * Adds an "action" to the action queue. Actions are method calls on the Replicant object itself. * @param fn * @param args * @private */ private _queueAction; /** * Emits "declareReplicant" via the socket. * @private */ private _declare; /** * Overwrites the value completely, and assigns a new one. * @param newValue {*} - The value to assign. * @param revision {number} - The new revision number. * @private */ private _assignValue; /** * Handles incoming operations performed on Array and Object Replicants. * Requests a fullUpdate if it determines that we're not at the latest revision of this Replicant. * @param data {object} - A record of operations to perform. * @private */ private _handleOperations; private _handleDisconnect; /** * Requests the latest value from the Replicator, discarding the local value. * @private */ private _fullUpdate; } //#endregion //#region src/client/api/api.client.d.ts type SendMessageCb = (error?: unknown, response?: T) => void; type ReadReplicantCb = (value: T | undefined) => void; interface EventMap {} declare class NodeCGAPIClient = NodeCG.Bundle.UnknownConfig> extends NodeCGAPIBase<"client", C, EventMap> { static Replicant = NodeCG.Replicant.Options>(name: string, namespace: string, opts?: O): ClientReplicant; static sendMessageToBundle(messageName: string, bundleName: string, cb: SendMessageCb): void; static sendMessageToBundle(messageName: string, bundleName: string, data?: unknown): Promise; static sendMessageToBundle(messageName: string, bundleName: string, data: unknown, cb: SendMessageCb): void; static readReplicant(name: string, namespace: string, cb: ReadReplicantCb): void; get Logger(): new (name: string) => NodeCG.Logger; get log(): NodeCG.Logger; /** * A filtered copy of the NodeCG server config with some sensitive keys removed. */ get config(): DeepReadonly; readonly socket: TypedClientSocket; soundsReady: boolean; private readonly _soundFiles?; private readonly _bundleVolume?; private readonly _masterVolume?; private _soundCues; private _memoizedLogger?; constructor(bundle: NodeCG.Bundle & { _hasSounds?: boolean; }, socket: TypedClientSocket); /** * _Browser only, except workers_
* Returns the specified dialog element. * @param {string} name - The desired dialog's name. * @param {string} [bundle=CURR_BNDL] - The bundle from which to select the dialog. * @returns {object} */ getDialog(name: string, bundle?: string): (HTMLElement & { opened: boolean; close: () => void; open: () => void; }) | undefined; /** * _Browser only, except workers_
* Returns the specified dialog's iframe document. * @param {string} name - The desired dialog's name. * @param {string} [bundle=CURR_BNDL] - The bundle from which to select the dialog. * @returns {object} */ getDialogDocument(name: string, bundle?: string): Document | undefined; /** * Returns the sound cue of the provided `cueName` in the current bundle. * Returns undefined if a cue by that name cannot be found in this bundle. */ findCue(cueName: string): NodeCG.SoundCue | undefined; /** * Plays the sound cue of the provided `cueName` in the current bundle. * Does nothing if the cue doesn't exist or if the cue has no assigned file to play. * @param cueName {String} * @param [opts] {Object} * @param [opts.updateVolume=true] - Whether or not to let NodeCG automatically update this instance's volume * when the user changes it on the dashboard. * @returns {Object|undefined} - A SoundJS AbstractAudioInstance. */ playSound(cueName: string, { updateVolume }?: { updateVolume: boolean; }): createjs.AbstractSoundInstance; /** * Stops all currently playing instances of the provided `cueName`. * @param cueName {String} */ stopSound(cueName: string): void; /** * Stops all currently playing sounds on the page. */ stopAllSounds(): void; sendMessageToBundle(messageName: string, bundleName: string, cb: SendMessageCb): void; sendMessageToBundle(messageName: string, bundleName: string, data?: unknown): Promise; sendMessageToBundle(messageName: string, bundleName: string, data: unknown, cb: SendMessageCb): void; sendMessage(messageName: string, cb: SendMessageCb): void; sendMessage(messageName: string, data?: unknown): Promise; sendMessage(messageName: string, data: unknown, cb: SendMessageCb): void; readReplicant(name: string, cb: ReadReplicantCb): void; readReplicant(name: string, namespace: string, cb: ReadReplicantCb): void; protected _replicantFactory: = NodeCG.Replicant.Options>(name: string, namespace: string, opts: O) => ClientReplicant; private _registerSounds; private _setInstanceVolume; private _updateInstanceVolumes; } //#endregion export { NodeCGAPIClient }; //# sourceMappingURL=api.client.d.ts.map