Safer type checking / evaluate if addEventListener only once