Closed jviide closed 8 months ago
Latest commit: 00be0d42da9a7f06157063d6827c4ab8ef82c414
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Name | Link |
---|---|
Latest commit | 00be0d42da9a7f06157063d6827c4ab8ef82c414 |
Latest deploy log | https://app.netlify.com/sites/preact-signals-demo/deploys/65f0d237cc7299000833f5a3 |
Deploy Preview | https://deploy-preview-520--preact-signals-demo.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
While the size reduction is nice, wouldn't this create a bit of a weird discrepancy? If someone's using Preact and (for some godforsaken reason) needs to support ES5, there's now this weird little bit of ES6 in their otherwise ES5 bundles.
I'm just not sure this makes much sense to land on its own.
Ah totally forgot about ES5. Yeah that might make it difficult to merge this PR as long as Preact itself ships like that.
Yep, good points.
This pull request converts the signals-core package to use ES6 classes instead of ES5-style prototypes. It effectively reverts the changes introduced in #160.
Notes:
declare
keyword. This avoids a redundant property assignment getting added to the class's constructor. There is a comment included that describes this reasoning.Computed
->Signal
toComputed
->Intermediate
->Signal
. The Preact binding needed to be modified to take this into account: settingSignal.prototype.constructor
toundefined
gets masked andComputed.prototype.constructor
is notundefined
anymore. Which led to this cursed piece of code by Yours Truly.The sizes of the build artifacts before and after this change are listed below. In general the number of bytes saved falls around 40-60 bytes, depending on the output format.