fix(Generator): Use the window object instead of global