mtcute/packages/dispatcher/src/propagation.ts

35 lines
1,004 B
TypeScript
Raw Normal View History

const _sym = require('es6-symbol')
/**
* Stop the propagation of the event through any handler groups
* on the current dispatcher.
*
* However, returning this will still execute children
*/
export const StopPropagation: unique symbol = _sym.for('mtcute:StopPropagation')
/**
* Stop the propagation of the event through any handler groups
* on the current dispatcher, and any of its children.
*
* Note that if current dispatcher is a child,
* this will not prevent from propagating the event
* to other children of current's parent.
*/
export const StopChildrenPropagation: unique symbol = _sym.for(
'mtcute:StopChildrenPropagation'
)
/**
* Continue propagating the event inside the same handler group.
*/
export const ContinuePropagation: unique symbol = _sym.for(
'mtcute:ContinuePropagation'
)
2021-06-12 01:13:02 +03:00
export type PropagationSymbol = symbol
// this seems to cause issues after publishing
// | typeof StopPropagation
// | typeof ContinuePropagation
// | typeof StopChildrenPropagation