This looks strange to me. You have this immediately invoked function expression that is doing an initialization at loading time of the file. I reader not familiarized with the code will likely miss this part when trying to understand the flow of the code. This would be more clear if located within a constructor or grouped with the other addEventListener calls.