FAQ
Hi Gophers,

I worked into the wee hours last night trying out the RiotJS<https://moot.it/riotjs/docs/>approach.

I like it a lot - it is just so awesomely simple, straight forward,
pragmatic, and minimalist - in the true spirit of Go!

What doesn't work as well, is JavaScript, haha ;-)

TypeScript seemed like a natural step up from JavaScript, but as it turns
out, the type system doesn't really allow for practical mixins.

So I started tinkering with GopherJS <https://github.com/gopherjs/gopherjs>instead

I'm already sold on Go, and after playing around with GopherJS, I am pretty
much totally sold on that as well, and I want to use it for Riot-style
client-side development.

So I started porting the RiotJS components to Go - beginning with the event
sink.

Here's what I got so far:

http://play.golang.org/p/I_B5E0ZwuU

Riot's $.observable() decorator uses strings for event types, and I've seen
something similar done in Go, but I think we can do better - I'm using
structs for events, and closures for event handlers, made possible by a
little reflection, in order to keep things type-safe.

By embedding a Sink in a model type, this should make for very intuitive
"mix-in like" syntax.

I tried it on the GopherJS playground, and it does work :-)

I have to sleep now, so the missing Off() method will come another night,
but I'm pretty jazzed about Go and GopherJS and I had to share this... :-)

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 16, '14 at 6:23a
activeMar 16, '14 at 6:23a
posts1
users1
websitegolang.org

1 user in discussion

Rasmus Schultz: 1 post

People

Translate

site design / logo © 2022 Grokbase