import { Operation } from '../operation'; import { Labels } from '../labels'; /** * Apply the given labels to the current task. This can be used to dynamically * set labels, for example as the state of the operation changes, or as more * information becomes available. * * If possible you should prefer to set labels statically using {@link withLabels}, * or by passing them as options to {@link run} or {@link spawn}. * * Existing labels are not removed, but may be overwritten if the key is the * same. * * ### Example * * ```typescript * import { main, label } from 'effection'; * * function createSocket(url) { * // use `withLabels` for information which is known statically * return withLabels(function*() { * let socket = new WebSocket(url); * yield once(socket, 'open'); * * // state has changed dynamically, use `label` to update labels * yield label({ state: 'open'}); * * let initMessage = yield once(socket, 'message'); * * // we received a handshake message with some new information * yield label({ state: 'initialized', connectionId: initMessage.data.connectionId }); * * // ... * }, { labels: { name: 'createSocket', state: 'pending' }}); * }); * ``` * * @param labels the labels to apply */ export declare function label(labels: Labels): Operation; //# sourceMappingURL=label.d.ts.map