darkf / darkfo

DarkFO, a post-nuclear RPG remake (of Fallout 2)
Apache License 2.0
135 stars 12 forks source link

Deprecate and remove jQuery #102

Closed darkf closed 6 years ago

darkf commented 6 years ago

jQuery is an unnecessary dependency with modern DOM APIs, and we can fully replace it. (We're also on an ancient, unsupported version of jQuery.)

The most annoying thing is .animate, but it's not hard to implement and can go in ui or such.

darkf commented 6 years ago

105 will make this a ton easier by obviating the need for jQuery in the UI. What's left is some minor jQuery utility functions which are trivially replaceable (e.g. by raw XHR requests or fetch, or Object.assign) or .animate (which is doable, we can use requestAnimationFrame or CSS3 animations.)

darkf commented 6 years ago

We also have a mock type stub for jQuery (called mockjq) which we can use to replace jQuery piecemeal and ensure it's no longer used.

darkf commented 6 years ago

In ui, it seems like they follow a few common patterns:

So the grunt work is going to be the first three.

darkf commented 6 years ago

For .animate we can use CSS transitions (e.g. transition: top 1s ease;), which is easier and probably faster.

darkf commented 6 years ago

Okay, .animate was replaced (whoo!) with a CSS transition (slightly hacky, but that's browsers for you; it's still much better than jQuery.)

Some other things were replaced too (like scroll{Left,Top}, etc.)

Currently:

128

Which is not bad, just a lot of boring work.

darkf commented 6 years ago

Mouse wheel events should use the wheel / onwheel event (MDN).

darkf commented 6 years ago

XHR invocations are ported.

darkf commented 6 years ago

Woot, done! 9618bba

🎉 🎉 🎉