Await async pageBeforeOut

Hello, I need the pageBeforeOut functions to wait for my asynchronous code to finish before it removes the page from the DOM as my code reads the data from the pages. Otherwise it can not be accessed anymore. Any Idea how I can tell F7 to await the pageBeforeOut functions?