Register custom event only first time.
TypeScript definition.