mainwindow never changes, no need to set it or keep it. just get it via the parent and save it in the JSLinks object