News for hackers. Stuff that matters.

developit

This is not true, since Preact only implements the same software interface. Its internals are fundamentally different and not a derivative work.

Software interfaces cannot be patented - this has been upheld in every court, most recently in Google V Oracle.

You can use the PWA anywhere, it works very well.
That would make collaboration much much more difficult :)
I love this as a job perk. Get paid while giving back.
Re:Mitt: 200 byte functional event emitter / pubsub on Tuesday January 17, 2017 @08:42AM (#13417391)
Just size and a few really minor API nitpicks. If you're writing for Node, just use the built-in one.
Re:Rax – A universal React-compatible render engine on Friday January 13, 2017 @10:12AM (#13391364)
Yup, though the Rax benchmarks are especially bad. Calling a function with unchanging arguments in a loop with a constant number of iterations is going to trigger about the least real-world performance characteristics you could ask for, haha. I'm happy to see more people getting into the VDOM space, but it sucks to have to explain all the pitfalls every time a new broken benchmark comes out.
Re:Rax – A universal React-compatible render engine on Friday January 13, 2017 @10:09AM (#13391339)
If you're loading libraries individually off a shared CDN, performance must not be much of a concern :P
Re:Rax – A universal React-compatible render engine on Friday January 13, 2017 @10:08AM (#13391335)
FWIW, there is actually no code in React to normalize touch events between browsers. For touch events react and preact are basically the same (aside from React creating a lot of pooled objects for their synthetic event system, and preact not using delegation).
Re:Preact rendering in a web worker on Monday December 05, 2016 @03:28PM (#13109143)
So far, for the use-cases I can think of, it's probably not worth it. Serialization and thread overhead outweigh any benefit. There are definitely better use-cases for workers than VDOM.
Re:Preact rendering in a web worker on Monday December 05, 2016 @01:09PM (#13107652)
The theory is that if the diff were sufficiently expensive on its own (it's generally not), that cost is offloaded. There may be gains to be made by moving most of the application code out of the UI thread (less memory usage in that thread, etc).

In this demo, all the UI thread is doing is receiving batches of small instructions to update the DOM. Stuff like "change the text content of element #12" (all elements get assigned an ID).

That said, this is just an experiment. I wanted to get a real sense of whether threading was something we should care about for DOM manipulation.

Re:Preact rendering in a web worker on Monday December 05, 2016 @12:43PM (#13107368)
gah this makes me want a sonos
Re:Preact rendering in a web worker on Monday December 05, 2016 @12:42PM (#13107363)
You should probably look at the test before making firm opinions on the matter. Do you even know what is failing?
Re:Preact rendering in a web worker on Monday December 05, 2016 @12:02PM (#13106905)
That is untrue. There are currently two small test failures in IE on master, hence the graph. The library supports IE9+.
Re:Preact rendering in a web worker on Monday December 05, 2016 @11:21AM (#13106480)
Agreed. Someone submitted this before I got around to writing that post, heh. Synopsis: fake DOM in the worker w/ MutationObserver that sends batched changes up to the UI thread. Event delegation to get things back into the worker. It's actually relatively straightforward, demo code is a mess though.
Re:React: Mixins Considered Harmful on Monday July 18, 2016 @10:20AM (#12115162)
I think it's important people understand this. The last two points are precisely the reason String refs got moved from Preact's core into preact-compat.

Also, for the common-case usage of string refs, you can just use a helper to insert things into `this.refs`:

https://gist.github.com/developit/63e7a81a507c368f7fc0898076...

Broken how?
Seems a little outdated to stick with ES5, particularly in the examples.
Re:Preact, a fast 3k React alternative on Friday January 29, 2016 @07:49PM (#10999838)
https://github.com/developit/preact-perf https://localvoid.github.io/uibench/

In the second benchmark, Preact is only faster in around half of the tests. However, this benchmark only tests complete top-down re-renders and intentionally triggers synchronous rendering in Preact. In a normal app composed of Components, Preact batches state changes which improves performance considerably.

Re:Preact, a fast 3k React alternative on Friday January 29, 2016 @07:40PM (#10999785)
Yeah... causing this confusion is one of my more regrettable mistakes of the year. Honestly if some amazing name came along I would not be entirely opposed to changing it.
Re:Preact, a fast 3k React alternative on Friday January 29, 2016 @07:38PM (#10999775)
Yup. I've successfully added contexts to Preact, but I still am not 100% sold on the value. Thankfully, simply supporting them doesn't add much bloat.
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:50PM (#10992477)
Not to pile on here, but I try to use pure functions instead of Components as often as I can. The class keyword is sugar, sure, but like others have said - that ship has sailed. Personally, I just like that it's a language feature, since Components are the only time I ever use the class keyword my brain treats them as a 1:1 mapping. Perhaps it has something to do with both Classes and Components having a defined lifecycle? Cheers.
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:45PM (#10992459)
PropTypes are supported out of the box in preact-compat. You could also use them via a preact vnode hook and the "proptypes" module (npm.im/proptypes), which is just pulled from React's codebase. Synthetic events I'm very much open to feedback on - I tend to fire actual DOM events in my Karma tests, but it seems that less common.
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:43PM (#10992447)
This is extremely interesting to me and I would love to hear why. I skipped synthetic events because I didn't feel they were necessary, but I would appreciate additional insight.
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:40PM (#10992432)
You could take 10 seconds and write 1-line modules to abstract your specific imports - "import Component from 'mycomponent'". This is not a valid argument in favor of modularity or small modules (and I love small modules).
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:37PM (#10992409)
In my case, I wanted to take advantage of React-style components, but needed to use them in a massive (MM users) 10-year old website built on jQuery and Backbone, backed by PHP. Since there is no room for overhead, Preact fits very nicely.
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:35PM (#10992402)
It started as a CodePen. Thankfully, someone switched the build to use Rollup, which makes it very easy to move things around. Modular structure (in terms of files) will be part of the 3.0 major bump.
Re:Preact, a fast 3k React alternative on Thursday January 28, 2016 @06:33PM (#10992386)
Hiya! author here. I have used Mercury and Mithril, both are great. I personally think there is a use-case for both modular and batteries-included libraries. There's an open issue for modularizing preact in the tracker that'll be addressed shortly if that helps.
Re:GitHub Outage on Wednesday January 27, 2016 @07:29PM (#10984818)
If you listen closely you can hear the sound of all bower-dependent builds on earth failing in synchrony

Older »