Skip to main content

CotomyWindow

Global window wrapper for lifecycle and layout events.

Static Properties

PropertyTypeDescription
instanceCotomyWindowSingleton instance.

Properties

PropertyTypeDescription
initializedbooleantrue after the body is initialized.
reloadingbooleantrue if a reload is in progress.
bodyCotomyElementWrapped document body.
scrollTopnumberCurrent vertical scroll position.
scrollLeftnumberCurrent horizontal scroll position.
widthnumberWindow inner width.
heightnumberWindow inner height.
documentWidthnumberDocument scroll width.
documentHeightnumberDocument scroll height.

Methods

MethodDescription
initialize()Initializes body, layout events, and mutation observer.
reload()Reloads the page and marks as reloading.
append(element)Appends content to the body.
moveNext(focused, shift?)Moves focus to the next focusable element.
trigger(event, e?)Dispatches a window event.
on(event, handle)Registers a window event handler.
off(event, handle?)Removes a window event handler.
load(handle)Shortcut for window load event.
ready(handle)Handles the cotomy:ready event.
resize(handle?)Registers or triggers resize.
scroll(handle?)Registers or triggers scroll.
scrollTo(target, options?)Scrolls to a selector or element.
changeLayout(handle?)Registers or triggers layout change.
pageshow(handle?)Registers or triggers pageshow.