Skip to:

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#1616 closed enhancement (worksforme)

Defining Custom javascript events for Ajax based loading of activity etc

Reported by: sbrajesh's profile sbrajesh Owned by:
Milestone: 1.2 Priority: major
Severity: Version:
Component: Keywords:
Cc: sbrajesh, jeff@…

Description (last modified by apeatling)

As of bp 1.2, activity stream is loaded using ajax so are some other components. So what If I want to call one of my javascript method after the activity is loaded. How do I get the idea when the activity is loaded(Just an example).
Would not it be better to define custom events and fire them when some content is loaded(say activity_loaded) ,other developers can hook their custom code to these events. YUI provides an easy way to define custom events but there can be other implementations too.

What are other developers are thinking about it? How do you know from you javascript code when activity is loaded or not.

I will request to please add custom events on the completion of the actions, like after calling "bp_activity_request","bp_filter_request". That would help the third party plugin developers tremendously.

Thought please.

Change History (9)

#1 @sbrajesh
14 years ago

  • Cc sbrajesh added

#2 @jivany
14 years ago

  • Cc jeff@… added

Does r2322 help?

#3 @sbrajesh
14 years ago

hi Jeff
I have just updated to r2323 and I still don't see the solutions. The problem is not how to call your method, the problem is how do we know when to call the our spcific javascript methods which we want to call after content is loaded, ondomready will not help in this case.

#4 @jivany
14 years ago

Sorry, you're correct, I had misunderstood the changes Andy made in r2322.

#5 @apeatling
14 years ago

  • Resolution set to worksforme
  • Status changed from new to closed

Take a look at "Global Events" on this page:

You should be able to hook into the "ajaxComplete" event.

#6 follow-up: @apeatling
14 years ago

  • Description modified (diff)

Actually "ajaxStop" may be the event you are looking for.

#7 @apeatling
14 years ago

  • Description modified (diff)

#8 in reply to: ↑ 6 @sbrajesh
14 years ago

Replying to apeatling:

Actually "ajaxStop" may be the event you are looking for.

Thanks Andy.yes, ajaxStop can be a workaround, but in case of your own plugin doing ajax requests, It may cause trouble as it is a global event.
I will experiment more and will let you know again.

#9 @apeatling
14 years ago

If you or anyone can think of a smarter way, I'm happy to consider.

Note: See TracTickets for help on using tickets.