Page tree
Skip to end of metadata
Go to start of metadata

The display.isOpen() function returns a boolean value based on whether the display file has previously been opened. The display file can be opened explicitly with the display.open() method or implicitly by the system, which happens when a rich display file is declared without the userOpen configuration property set to true.

Return Value

true (boolean): The display file was opened with display.open() and has not been closed with display.close(), or the display file was opened implicitly by the system. 

false (boolean): The display file has not yet been opened or was closed after being opened.  

Example

pjs.defineDisplay("display", "screen.json", { userOpen: true });

// display.isOpen() evaluates to false below because the display
// file has not yet been opened
if (!display.isOpen()) {
  display.open();
}

// Code to operate on the display file can go here

// display.isOpen() evaluates to true because the display was 
// previously opened
if (display.isOpen()){
  display.close();
}
 
// display.isOpen() will evaluate to false here because the display file
// is now closed
console.log(display.isOpen());

 

RPG Equivalent

%OPEN()