Module: layout

Methods

(static) block()

Blocks the UI so that the user can't type anything or click any elements. Use layout.unblock to remove the block.
Source:

(static) closeTag(targetWindowopt) → {boolean}

Close a tag that is currently open. Because the tags are added as DOM elements, the tag isn't really "open" in the sense that it would be missing the closing tag. Instead we jump out of the tag and set output focus back to its parent element.
Parameters:
Name Type Attributes Default Description
targetWindow number <optional>
0
Source:
Returns:
True if a tag was open, false if we were already at the top window level and nothing was done
Type
boolean

(static) focus(targetElement, targetWindowopt) → {boolean}

Set output focus to an element.
Parameters:
Name Type Attributes Default Description
targetElement string | object
targetWindow number <optional>
0
Source:
Returns:
True if the focus was set successfully, false if the element wasn't found
Type
boolean

(static) openTag(tagName, classes, targetWindowopt) → {boolean}

Create a new HTML element, append it to the target window, and set the output focus to the element. Example: layout.openTag( 'div', 'vorple', 0 ) -->
Parameters:
Name Type Attributes Default Description
tagName string Name of the tag to create
classes string Class names to add to the element
targetWindow number <optional>
0 The number of the target window
Source:
See:
  • layout.closeTag
Returns:
True
Type
boolean

(static) scrollTo(target, speedopt) → {promise}

Scroll an element into view. Scrolling is initiated only if the element isn't already fully in view or its top position is not in the top half of the page. If the element doesn't exist, the function doesn't do anything.
Parameters:
Name Type Attributes Default Description
target string | object The target element
speed number <optional>
500 The duration of the scroll animation in milliseconds
Source:
Returns:
A promise that resolves to true when the scroll animation ends, or resolves to false if no scrolling was needed (element doesn't exist or is already in view.)
Type
promise

(static) scrollToEnd(speedopt) → {promise}

Scroll to the end of the document.
Parameters:
Name Type Attributes Default Description
speed number <optional>
500 The duration of the scroll animation in milliseconds
Source:
Returns:
A promise that resolves when the scroll animation ends
Type
promise

(static) unblock()

Unblock the UI.
Source:
See:
  • layout.block