Call mainFun even if window and document aren't defined