Wick.Base extensibility - #193
Closed
hobbsythe6th wants to merge 53 commits into
Closed
Conversation
…com/hobbsythe6th/Candlestick into engine-package.json-update-betterer
…stick into vite-migrate
|
You just implemented the way extending classes was done before ES6. (before 2015, depending on the dev they switched in 2016 or 2017 to more modern practices) The problem with this method is not only is prototypal reflection slow in V8 (they use some optimizations which make it slower), prototypes affect ALL INSTANCES. The only way to track and localize the extensions made is creating a brand new class which extends Wick.Base. This will also affect editor code, since it only resets when the prototype is re-defined (e.g.: reloading the page). It's better to just do |
Contributor
Author
|
I'm new to JS so I understood nothing :/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was inspired by paperjs' inject() function so I added this one. It allows you to define a custom function for any instance of any class derived from Wick.Base . You can't add a custom API into EVERY instance yet, but I think this is a good starting point for the engine to become more customisable.
Also, if you want to you can technically just use it to define a new property but it's a bit too much hassle.
Branched off of the engine update branch, which in turn is branched off of the vite migration. I'm sorry, but I just can't live with CRA/Gulp anymore.
Edit: parameters are now passed as arrays, and this has been added to the code reference