[Neos] Event when Neos reloads content

Thomas Allmer d4kmor at gmail.com
Tue Aug 27 14:48:47 CEST 2013


just a quick thought how about "just" using a function... I don't know 
maybe use a global "Neos.Events Object" that holds these -
so people could just overwrite these if needed.

example jQuery:
Neos.Events.PageLoaded = function() {
	$(document).trigger('Neos.Events.PageLoaded');
	// or myEventObjects.trigger('Neos.Events.PageLoaded');
}

example MooTools:
Neos.Events.PageLoaded = function () {
	$(document).fireEvent('Neos.Events.PageLoaded');
	// or myEventObjects.fireEvent('Neos.Events.PageLoaded');
}

the function calling the event now "just" uses the function if available

if (Neos && Neos.Events && typeof(Neos.Events.PageLoaded) == 'function') {
	Neos.Events.PageLoaded();
	// maybe a some more "complex" call with parameters and stuff
}

didn't try any of this... just my 2 cents

cheers

On 27.08.2013 14:11, Jan-Erik Revsbech wrote:
>
>
> Christian Müller wrote:
>>>>
>>> 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?
> As far as I can see, triggering custom events in a browser independant
> manner (especially for IE <= 9) is not that easy, and would require the
> Site JS to do the actual listening in a specific way. It could be done,
> but would proably not be very pretty. Guess there is a reason why most
> JS-frameworks contains convenience methods for eventhandling:)
> Correct me if I'm wrong on this.
>
> Another solution, would be to trigger the event via the global jQuery
> event, only if this is available. That would work for all sites that
> manually include jQuery, but would not work for non-jquery sites. I
> guess that is not a feasible way either...
>
> /janerik


-- 
thomas allmer für moodley
mail: thomas.allmer at moodley.at
telefon: +43 (0) 1 581 08 75
www.moodley.at
moodley brand identity gmbh
belvederegasse 26, A-1040 wien
fn 275953 p, atu 62465914


More information about the Neos mailing list