@fredj are you sure you're adding a vector property to the window object here?

Also you could add a comment explaining why you create the layer each time. (Because you don't public methods to add/remove features to/from the source I guess.)