DiviArea.isClosed()

DiviArea.isClosed(key)

Check, whether a area is marked as “closed” for a certain time span.

This function returns true when the area is considered “closed”. This function does not provide information, on how long the closed-state will last.

Params

key string, required
ID/Key of the area. When no Area with the given ID exists on the current page, the key-string is treated like it is the final Area ID (see sample below).

Returns

Returns true when the given Area was marked as closed before. The return value is false, if the Area was not marked as closed, or if the closeFor duration passed – see DiviArea.markClosed() for details.

Examples

// Assume that the page contains the Area "#divi-area-test"
if ( DiviArea.isClosed('#divi-area-test') ) {
  // --> Checks the value of the localStorage entry "_da_divi-area-test".
  console.log('Area #divi-area-test is still closed');
}

// This happens, when the key is no valid Area ID:
if ( DiviArea.isClosed('Spaces In Key') ) {
  // --> Checks the value of the localStorage entry "_da_Spaces In Key".
  console.log('Spaces In Key is still closed');
}

Notes

No notes

Was this article helpful?

Related Articles

Need Support?

Can't find the answer you're looking for?
Get in touch with us