Skip to main content
Version: Current

foundation-layout.foundationlayout.tryloadlayoutfromlocalstorage

Home > @genesislcap/foundation-layout > FoundationLayout > tryLoadLayoutFromLocalStorage

FoundationLayout.tryLoadLayoutFromLocalStorage() method

Try to load a layout from local storage, or return false. Only required if manually calling FoundationLayout.registerItem()

Signature:

tryLoadLayoutFromLocalStorage(): boolean;

Returns:

boolean

boolean - true if a layout was loaded, false if not

Remarks

Attempt to load an autosaved layout from local storage, keyed on the auto-save-key attribute. If auto-save-key attribute is not set or there is no autosaved layout yet, this will return false. Else, true.

This function is automatically called when loading the layout via the declarative API so if you're not registering components via the JavaScript API then you don't need to call this function. If you *are* calling FoundationLayout.registerItem() then you should call this function immediately afterwards.

Will load the layout with handleMissingItem = 'placeholder so placeholder text will be shown for any missing items. Loads layout config with the cache disabled (this will likely only be called after the page has refreshed anyway, so there would have been no cached elements to try and recover).