Hi everyone on this list. First time posting here ;)

I'm writing here because I had an idea while working on a project that
required heavy use of javascript and I thought I would share it with the
world. Before I explain it, I would like to take a second to warn you that
this library might feel very controversial to some of you because it goes
against the grain when it comes to what's available in terms of JS
frameworks.

This small library is very early on and is very opinionated. Even so,
here's a few things that this library does.


*Javascript objects are bound to DOM element*

I may start with the most controversial feature. I know that prototype.js
had issue with this a while ago. But the web environment is not what it's
used to be.

*Event based response when dealing with JS request.*

I wanted to have something that could use rails' remote=true attributes and
be automatically dispatch the response to different object in the DOM. So I
build a custom XHR object that will take the response from JS and build an
event with the following naming scheme: "controller:action". So basically,
if you send a form with remote=true to create a new posts through the
PostsController, an event posts:create would be fired automatically.

*Automatic instantiation of objects*

Using the new DOM Observer pattern, it looks for any DOM object that
declares a javascript object and instantiate it automatically. If the
callback is defined in the object, the loaded callback is fired which allow
someone to bind events to that object as soon as it's ready.

*Bind HTML to JavaScript events*

HTML might be slower than JSON to render, but it offers a lot more
flexibility. You can look for attributes, children, etc.

I'm aware that this might all sound a little vague, so I made a gem that,
hopefully, will make it easier for you guys to understand.

https://github.com/pothibo/ethereal

Feel free to ask question if you have any :)

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/03a2539f-5b71-4777-acc9-feb2be7d6a39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedNov 4, '14 at 8:25p
activeNov 4, '14 at 8:25p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Pier-Olivier Thibault: 1 post

People

Translate

site design / logo © 2022 Grokbase