[Neos] Event when Neos reloads content

Aske Ertmann aske at moc.net
Tue Aug 27 18:39:19 CEST 2013


Hello

After discussing this with Jan-Erik I couldn't resist trying out custom events. And from what I could gather this is pretty straight forward, even for IE9+ compatibility, without any need for relying on some library.

I've put together a small sample http://jsfiddle.net/ExFnE/1/ and tested it in Chrome (OS X), Firefox (OS X), Safari (OS X), IE9 (native), IE10 (native) where it works.

There are some minor changes if there's need for IE8 support, but currently I don't think we will support that browser anyway and if we want to at some point I'd be happy to write the necessary fallbacks..

I like this approach better than relying on jQuery even if we could make it work with exposing the RequireJS version somehow and I also think it's better than exposing some global callback/event handler function/object.

Aske

On 27/08/2013, at 09.04, Christian Müller wrote:

> Jan-Erik Revsbech wrote:
>> 
>> 
>>> ------------------------------------------------------------------------
>>> 
>>> Jan-Erik Revsbech <mailto:janerik at moc.net>
>>> August 26, 2013 8:40 PM
>>> 
>>> 
>>> I just made a small test and there is no problem with triggering
>>> events with something like
>>> 
>>> $(document).trigger('T3.Neos.Event.PageLoaded');
>>> 
>> Actually it did not work like this, but only with
>> jQuery(document).trigger('T3.Neos.Event.PageLoaded'); so I guess the
>> communication between the encapsulated jQuery and the site jQuery
>> provides some challenges. Will have to look into that.
> 
> Mmmm, seems so, normally I would expect an event to be an event. But then you probably used your outside jQuery to bind the event. That wouldn't work for sites without jQuery. Maybe plain JS could be used?
> 
>> 
>> 
>>> and then listeting for this events from the Site JS.
>>> 
>>> What is the preferred naming of the event names? Then I'll create a
>>> patch for this.
> 
> We want to get rid of the T3 eventually but I think the rest sounds just fine. So something like 'Neos.Event.PageLoaded'. Thank you for taking care!
> _______________________________________________
> Neos mailing list
> Neos at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/neos



More information about the Neos mailing list