import { Message, MessageMap, NoMeta, TwistersBuffer, TwistersOptions } from './types';
import { SpinnerLoop } from './utils';
export declare type ForEachMessageCallback = (message: Message, name: string, allMessages: MessageMap) => void;
/**
* The function used to render messages if a render function is not defined by the Message object.
*/
export declare function defaultRender(message: Message, frame: string | null): string;
export declare class Twisters {
options: TwistersOptions;
spinnerLoop: SpinnerLoop;
/** @deprecated Please reference `options.buffer` instead */
lineBuffer: TwistersBuffer;
protected messages: MessageMap;
/**
* Create new Twisters instance
* @param options
* @param buffer __DEPRECATED__ Please define `buffer` in `options` instead of passing it as the second constructor parameter
*/
constructor(options?: Partial>, buffer?: TwistersBuffer);
/**
* Get buffered message by name.
*/
pick(name: string): Message | undefined;
/**
* Get buffered message count.
*/
messageCount(): number;
/**
* Iterate over buffered messages and invoke the callback for each one.
*/
forEachMessage(callback: ForEachMessageCallback): void;
/**
* Returns true if any of the buffered messages are active, otherwise false.
*/
hasActiveMessage(): boolean;
/**
* Add/update a message
*
* @remarks Message content is not cached by default.
* **This means that message text must be provided to subsequent `put` calls,
* even if the text is unchanged.**
* See {@Link https://github.com/adamjarret/twisters/blob/master/packages/examples-js/bin/custom-cache.js | custom-cache.js example} to update messages using only changed attributes.
*/
put(name: string, messageOpt?: Partial>): Message;
/**
* Log an inactive message
* (convenience function equivalent to `put('text', { active: false })`)
*/
log(text: string, messageOpt?: Partial>): Message;
/**
* Remove a buffered message by name
* (convenience function equivalent to `put('name', { removed: true })`)
* @returns The existing message that was removed or undefined if no message was found for the provided key
*/
remove(name: string): Message | undefined;
/**
* Flush messages to stream.
* @remarks This is called automatically if the `flushInactive` option is true.
* Otherwise this must be called manually when all messages have finished.
*/
flush(): void;
protected refresh(): void;
protected updateBuffer(frame?: string): void;
}
export default Twisters;