News for hackers. Stuff that matters.
Re:Show HN: 1kb JavaScript library for building front end ap... by franciscop on Sunday June 25, 2017 @11:44AM (#14630523)
That hyperx onclick example [1] is really clever if I understand it correctly from a quick overview [2]. It stores a reference to the event using the template literals features (reading manually the interpolated arguments):

    html`<button onclick=${() => alert("Hi")}>Click</button>`
Not sure how it is attached then; from the syntax it can only be a traditional onclick="" event, however in the examples [3] [4] they are attached as an addEventListener() events. I'd have to dig deeper to understand it.

I've done something slightly similar in the past:

    dom.body.html = `<button ${evt.on.click(e => console.log(e))}>Click me</button>`;
However, for that syntax above I'm using two different tiny libraries I made while the author could combine both of them into one + virtual DOM. Great work there!

Honest question as the author seems the submitter, what are the target developers for your library? It seems (to me) that virtual dom + JSX is overkill for simple websites, while the big webapps seems to want the enterprise-backed React/Angular/Ember/Etc.

[1] https://github.com/hyperapp/hyperapp/blob/master/docs/hyperx...

[2] https://github.com/hyperapp/hyperapp/blob/master/src/app.js#...

[3] https://hyperapp.glitch.me/clicks

[4] https://hyperapp.glitch.me/slider

Re:Show HN: 1kb JavaScript library for building front end ap... by jbucaran on Sunday June 25, 2017 @01:31PM (#14631117)
> What are the target developers for your library?

Anyone. Big app devs, small app devs. For the record, you can user hyperapp with any of the following technologies:

- JSX

- A string template literal based solution like hyperx or t7.

- The built-in hyperscript-style `h` function (https://goo.gl/da3U3P).

Re:Show HN: 1kb JavaScript library for building front end ap... by finchisko on Sunday June 25, 2017 @02:06PM (#14631288)
Any example on jsx? Is it react jsx or something else?

Edit: already found example in project github.

Looks promising. Currently I'm looking for solution to replace jquery for one small popup for Chrome KeePassXC extension. HyperApp seems like good match. Thanks.

Re:Show HN: 1kb JavaScript library for building front end ap... by jbucaran on Sunday June 25, 2017 @03:17PM (#14631634)
Thanks! You can find more examples on CodePen.

- https://codepen.io/hyperapp