Javascript API
interfaces
Project

Interface: Project

The Project component represents the project itself. It is not represented visually. It has a list of all the Pages in the project

Hierarchy

Properties

componentType

Readonly componentType: string

The component's type. E.g. "View", "Text", "Button", "Page", etc.

Inherited from

Component.componentType


currentPage

Readonly currentPage: Page

The currently active, visible page.


id

Readonly id: number

Every Component is assigned a unique numerical id that cannot be changed. Components can be looked up by id using the get function.

Inherited from

Component.id


info

Readonly info: ProjectInfo

Project information.


name

name: undefined | string

Every Component can have a user-assigned name. It can be anything and is not guaranteed to be unique. Components can be looked up by name using the get function.

Inherited from

Component.name


pages

Readonly pages: Page[]

The pages in the project.


scrollLeft

scrollLeft: number

The number of pixels that a Container's content is scrolled horizontally.

Inherited from

Scrollable.scrollLeft


scrollTop

scrollTop: number

The number of pixels that a Container's content is scrolled vertically.

Inherited from

Scrollable.scrollTop


viewportHeight

Readonly viewportHeight: number

The height of the browser viewport (window interior) in pixels.


viewportWidth

Readonly viewportWidth: number

The width of the browser viewport (window interior) in pixels.

Methods

clone

clone(): Project

Create an exact duplicate of a component.

The clone must be added to a container with appendChild to be visible.

Returns

Project

Example

const clone = view.clone();
clone.x = 100;
clone.y = 100;
view.page.appendChild(clone);

Overrides

Component.clone


dispatchEvent

dispatchEvent(event): Promise (opens in a new tab)<void>

Triggers the event listeners for the specified event.

Parameters

NameType
eventEvent (opens in a new tab)

Returns

Promise (opens in a new tab)<void>

Inherited from

Component.dispatchEvent


on

on<K>(type, listener, options?): () => void

Add an event listener to the component.

Type parameters

NameType
Kextends keyof EventHandlersEventMap

Parameters

NameType
typeK
listener(event: EventHandlersEventMap[K]) => any
options?EventListenerOptions

Returns

fn

Returns a function that removes the event listener.

▸ (): void

Add an event listener to the component.

Returns

void

Returns a function that removes the event listener.

Inherited from

Component.on


submit

submit(serviceId, data): Promise (opens in a new tab)<void>

Submit data to a project service

Parameters

NameType
serviceIdstring
dataRecord (opens in a new tab)<string, string | number | boolean | Date (opens in a new tab)>

Returns

Promise (opens in a new tab)<void>