[Enhancement] Moving away from window to a generic global context

This is to prepare for running inside of node