Docs

API

getElement method

loopic.getElement([queryString])

  • queryString String
  • returns Object
    • domNode DOM Node
    • type String

Description

Method returns an object by it's ID containing DOM node reference and type. Note: Please use this method instead of document.querySelector() or similar because if we change something in our export file architecture in the future, your projects may break.

Example

const color = loopic.getElement("homeTeamColor");
color.domNode.style.backgroundColor = "red";
color.domNode.innerHTML = "Example inner HTML";

Nested compositions

Accessing elements of the nested compositions is simple and all it requires is passing a composition dynamic id and a comma. After comma you can reference any element within that composition.

const playerOneOnField = loopic.getElement("_fieldComposition._player1");
const playerTwoOnField = loopic.getElement("_fieldComposition._player2");