Class: BreakToken

BreakToken(node, overflowArrayopt)

Represents a token used to manage breaks (e.g., page or line breaks) in layout rendering. Holds information about the current node, overflow content, and break requirements.

Constructor

new BreakToken(node, overflowArrayopt)

Creates a new BreakToken instance.

Creates a new BreakToken instance.

Parameters:
Name Type Attributes Default Description
node Node

The DOM node this break token is associated with.

overflowArray Array.<Object> <optional>
[]

An optional array of overflow items from layout.

Source:

Members

breakNeededAt :Array.<Node>

Type:
  • Array.<Node>
Source:

finished :boolean

Type:
  • boolean
Source:

node :Node

Type:
  • Node
Source:

overflow :Array.<Object>

Type:
  • Array.<Object>
Source:

Methods

addNeedsBreak(needsBreak)

Adds a DOM node that requires a break (e.g., forced page break).

Adds a DOM node that requires a break (e.g., forced page break).

Parameters:
Name Type Description
needsBreak Node

A DOM node where a break is required.

Source:

equals(otherBreakToken) → {boolean}

Compares this BreakToken to another to determine equality.

Compares this BreakToken to another to determine equality.

Parameters:
Name Type Description
otherBreakToken BreakToken

Another BreakToken to compare with.

Source:
Returns:

True if both BreakTokens are equivalent; otherwise, false.

Type
boolean

getForcedBreakQueue() → {Array.<Node>}

Gets the current queue of nodes where breaks are needed.

Gets the current queue of nodes where breaks are needed.

Source:
Returns:

An array of nodes requiring breaks.

Type
Array.<Node>

getNextNeedsBreak() → {Node|undefined}

Retrieves and removes the next node that needs a break.

Retrieves and removes the next node that needs a break.

Source:
Returns:

The next node requiring a break, or undefined if none remain.

Type
Node | undefined

isFinished() → {boolean}

Checks whether the BreakToken has been marked as finished.

Checks whether the BreakToken has been marked as finished.

Source:
Returns:

True if finished, otherwise false.

Type
boolean

setFinished()

Marks the BreakToken as finished (i.e., no further processing required).

Marks the BreakToken as finished (i.e., no further processing required).

Source:

setForcedBreakQueue(queue) → {Array.<Node>}

Sets the queue of nodes where breaks are needed.

Sets the queue of nodes where breaks are needed.

Parameters:
Name Type Description
queue Array.<Node>

The new queue of nodes requiring breaks.

Source:
Returns:

The updated queue.

Type
Array.<Node>