beforeLoad() is a special function that allows you to run JavaScript code before a Genie screen is rendered. This is useful, for example, to adjust the X/Y multipliers based on the display size. If defined, it will be called before every Genie screen is rendered.

Example:

function beforeLoad() {

  if (pui.genie.displaySize == 132) {

    pui.multX = 6;
    pui.multY = 20;

  }
  else {

    pui.multX = 8;
    pui.multY = 23;

  }

}