Hooks and Plugins

30 views
Skip to first unread message

Michael Nietzold

unread,
Apr 14, 2012, 2:58:43 PM4/14/12
to iui-dev...@googlegroups.com
Hi,

i like to write my own extensions or plugins to iui. i like to do this because i dont know if my solutions are interesting for iui.

for example i have some requirement to decode a form into an uri, replace some divs from a response, fire javascript from a response etc.

but with the design of the iui,js now (i used 0.40 dev2) the only solution is to mix this into the original iui.js 

but i like more this: leave iui,js untouched and load a second javascript file with my extensions.

but for this there should be a easy plugin architecture:
- add my own handlers to the a:click listener (just now its not possible because i can not add my handlers before the iui click event listener)
- change (overwrite) some methods to fit my needs


maybe there can be implemented some points and hooks where i can implement my own behaviour.

Rémi Grumeau

unread,
Apr 15, 2012, 11:59:33 AM4/15/12
to iui-dev...@googlegroups.com
That's a very good topic I'd like to rise too with theming... as an iUI 0.5 goal.

Dunno what you really need to do but it's most of the time more interesting to rely on beforetransition/aftertransition events you can activate using /iui/js/iui-event-log.js

Remi
--
You received this message because you are subscribed to the Google Groups "iui-developers" group.
To post to this group, send email to iui-dev...@googlegroups.com.
To unsubscribe from this group, send email to iui-developer...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/iui-developers?hl=en.

Michael Nietzold

unread,
Apr 15, 2012, 1:22:26 PM4/15/12
to iui-dev...@googlegroups.com
i can not use this events, because i have different click handlers ... 

Remi Grumeau

unread,
Apr 15, 2012, 5:40:43 PM4/15/12
to iui-dev...@googlegroups.com
What do you mean by different click handlers?


Sent from my BlackBerry® PlayBook™
www.blackberry.com





From: "Michael Nietzold" <niet...@gmail.com>
To: "iui-dev...@googlegroups.com" <iui-dev...@googlegroups.com>
Sent: April 15, 2012 7:22 PM
Subject: Re: Hooks and Plugins

Sean Gilligan

unread,
Apr 15, 2012, 8:28:44 PM4/15/12
to iui-dev...@googlegroups.com
On 4/14/12 11:58 AM, Michael Nietzold wrote:
> i like to write my own extensions or plugins to iui. i like to do this
> because i dont know if my solutions are interesting for iui.


I understand what you mean. Many people extend iUI by modifying iui.js,
but this is not good because it makes maintenance difficult for app
developers and also makes it harder for people to submit
fixes/improvements back upstream. One of the main focuses of the 0.40
release has been to add an extensions mechanism. Rather than add an API
and a bunch of code to iUI, we implemented synthetic events such as
"beforetransition"/"aftertransition", "beforeinsert"/"afterinsert",
etc. These events seemed to address the majority of things that
developers wanted to do (and were submitting patches to add features to iUI)


>
> for example i have some requirement to decode a form into an uri,
> replace some divs from a response, fire javascript from a response etc.
>
> but with the design of the iui,js now (i used 0.40 dev2) the only
> solution is to mix this into the original iui.js


I'm not sure what you mean by "decode a form into a uri" but you should
be able to do the other things with 0.40-beta2:

to replace divs from a response: use "beforeinsert"
to fire javascript from a response: use "afterinsert" or use the
"jit-loader" plugin.


> but i like more this: leave iui,js untouched and load a second
> javascript file with my extensions.


I understand. I share this goal.


> but for this there should be a easy plugin architecture:
> - add my own handlers to the a:click listener (just now its not
> possible because i can not add my handlers before the iui click event
> listener)


I haven't tried this, but you might be able to do this by using the
"useCapture" flag on addEventListener
<https://developer.mozilla.org/en/DOM/element.addEventListener> and
calling stopPropagation from your handler in the case(s) where you don't
want the event handled by iUI.


> - change (overwrite) some methods to fit my needs
> maybe there can be implemented some points and hooks where i can
> implement my own behaviour.


Yes, iUI needs to be more flexible in this way. I'm thinking of an iUI
2.0 that will have a new architecture that will make this sort of thing
possible, but the current architecture makes this difficult. I've also
been thinking about integrating iUI with an MVC framework (like
Angular.js) and what changes would be required in the core to facilitate
this. Did you have some specific needs you could tell us about?


-- Sean


Michael Nietzold

unread,
Apr 17, 2012, 5:04:17 PM4/17/12
to iui-dev...@googlegroups.com
the next days i will try to update my iui extension to the current trunk.

after this i have a list of my changes i made ...


PS:
form to uri i mean:
i need convert values from a form to a get request with placeholders filled /mygeturl/searchvalue1/{value1}/value2/{value2}



--
You received this message because you are subscribed to the Google Groups "iui-developers" group.
To post to this group, send email to iui-developers@googlegroups.com.
To unsubscribe from this group, send email to iui-developers+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages