Firing an Event

6 views
Skip to first unread message

Eric

unread,
Aug 19, 2008, 4:11:33 PM8/19/08
to Ojay talk
Often times for testing ajax content and responses, I want to refresh
the page & trigger a particular action, without having to do the work
each time...

$('form').on('click', function(event) {
// ajax event
// logs the result
});

Coming from mootools, you can "addEvent('click', f() { ... })", then
"fireEvent('click')" on an element. How can I fire the event with
Ojay?

James Coglan

unread,
Aug 19, 2008, 4:19:46 PM8/19/08
to Ojay talk
> Coming from mootools, you can "addEvent('click', f() { ... })", then
> "fireEvent('click')" on an element.  How can I fire the event with
> Ojay?

Hi Eric,

Ojay doesn't have any testing features of its own -- we use YUI for
testing Ojay itself. YUI provides various tools for simulating user
actions, and these are detailed in the YUI docs:

http://developer.yahoo.com/yui/yuitest/#useractions

Do let us know how you get on. If there's significant demand for it,
we may look at rolling testing support into Ojay. Especially with the
announcement of YUI 3, we're considering how Ojay ought to operate as
a compatibility layer between YUI2 and YUI3.

James

Eric

unread,
Aug 19, 2008, 5:05:09 PM8/19/08
to Ojay talk
I saw how YUI3 is attempting to make things "chainable", but it really
doesn't make anything more readable, or, consequently, maintainable,
IMO.

Our company switched from Mootools to YUI for various reasons, but
needed the ease of use that jQuery/Mootools allows via chaining. Ojay
is all that and a bit more. As a result, we get accustomed to
chaining and expect opposite functions to exist.

For example, on('click') compliments trigger/fire('click'),
insert('<p>Howdy</p>') compliments remove(node), etc..

James Coglan

unread,
Aug 19, 2008, 5:16:49 PM8/19/08
to ojay...@googlegroups.com
Our company switched from Mootools to YUI for various reasons, but
needed the ease of use that jQuery/Mootools allows via chaining.  Ojay
is all that and a bit more.  As a result, we get accustomed to
chaining and expect opposite functions to exist.

For example, on('click') compliments trigger/fire('click'),
insert('<p>Howdy</p>') compliments remove(node), etc..

I do see what you're saying. We'll take a look at adding convenience methods as wrappers for the YAHOO.util.UserAction methods -- where possible we try to boostrap YUI functionality rather than re-implementing things ourselves; Ojay is really designed as a syntax/language enhancement rather than a more low-level JS library.

By the way, are you at liberty to show us what you're using Ojay for? We'd love to take a look!

James 

Eric

unread,
Aug 19, 2008, 11:45:21 PM8/19/08
to Ojay talk
We'll have a public launch of our site with some of this new
functionality within the next month, and we have really big plans for
it in the future that will be making use of YUI+Ojay extensively.

And I do agree about bootstrapping YUI functionality. I didn't
realize that YUI only allowed firing of custom events, not native
ones. As I mentioned earlier, coming from a Mootools background, the
syntax is where it's all at for me, especially in terms of chaining
methods. Ojay caught my attention by being able to change scope
within the chain.

Thanks again for making this in-house library available to all. It is
certainly much more versatile than DED|Chain, which lasted about 30
minutes until I need to add functionality =/

Eric

unread,
Sep 27, 2008, 12:25:24 PM9/27/08
to Ojay talk
Just wanted to let you guys know where we've been using Ojay so far.
My company just re-launched their site (http://www.whitefence.com/)
and used it mostly on company pages (http://www.whitefence.com/company/
att/).

There's some more stuff going on behind the scenes, but we wanted to
keep this launch as "clean" as possible to gauge traffic before adding
in most of the rich interactions.

Thanks again,
-Eric
Reply all
Reply to author
Forward
0 new messages