Remove almost all occurrences of .bind(this) which is considered bad practice in TypeScript since the bind function throws away the type of a function. It's a useless indirection anyway because an arrow function will bind the this reference.
Remove many more any types. Using any is considered bad practice in TypeScript and should only be used when porting JS to TS.
Remove 3 more @ts-ignores.
Remove NumericInput's moz prefixing of the Pointer Lock DOM event. Firefox has supported Pointer Lock without prefixing since Sep 2015.
Move each element's destroy function to immediately after the constructor. This makes it easier to spot if created resources are destroyed and registered event handlers are removed.
All in all, this is quite an attractive refactor since it removes a reasonable amount of code and makes DOM event handling easier to visually parse.
.bind(this)
which is considered bad practice in TypeScript since thebind
function throws away the type of a function. It's a useless indirection anyway because an arrow function will bind thethis
reference.any
types. Usingany
is considered bad practice in TypeScript and should only be used when porting JS to TS.@ts-ignore
s.NumericInput
'smoz
prefixing of the Pointer Lock DOM event. Firefox has supported Pointer Lock without prefixing since Sep 2015.destroy
function to immediately after theconstructor
. This makes it easier to spot if created resources are destroyed and registered event handlers are removed.All in all, this is quite an attractive refactor since it removes a reasonable amount of code and makes DOM event handling easier to visually parse.