DiviArea.Data.loopAllAreas()

DiviArea.Data.loopAllAreas(filter, callback)

Loop all registered Areas (of the given type) and execute the callback for them.

The filter is tested via DiviAreaItem.isType() to determine, which Areas to include in the callback loop.

The Areas are looped in no specific order.

Params

callback function, required
The callback to invoke for each Area. This callback receives two parameters: The area and the area-key (see the example below).
filter string, optional
A filter to limit Areas that are included in the callback loop.
Default: all

Returns

The function does not return anything.

Examples

// Output a list of all registered Areas in the JS console.
DiviArea.Data.loopAllAreas(function(area, key) {
  console.log( 'Area:', key, '| visible:', area.isVisible());
}, 'all');

/*
Sample output in console:

Area: #divi-area-74755 | visible: false
Area: #divi-area-74741 | visible: false
Area: #divi-area-74335 | visible: true
Area: #divi-area-73541 | visible: false
*/

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