Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. enygma1 +XWiki.mflorea - Content
-
... ... @@ -162,7 +162,7 @@ 162 162 163 163 The best part is, any scripts which are loaded using require are loaded //asynchronously// (all at the same time) and if they are not required, they are never loaded at all. 164 164 165 -== Bridging custom XWiki events fromPrototypetojQuery ==165 +== Bridging custom XWiki events between Prototype and jQuery == 166 166 167 167 Starting with XWiki 6.4 you can catch from jQuery the custom XWiki events that are fired from Prototype. 168 168 ... ... @@ -178,6 +178,22 @@ 178 178 }); 179 179 {{/code}} 180 180 181 +Starting with XWiki 7.1M1 the event listeners registered from Prototype are notified when a custom XWiki event is fired using the jQuery API. This doesn't mean you should write new event listeners using Prototype but that you can rely on existing event listeners until they are rewritten using jQuery. 182 + 183 +{{code language="js"}} 184 +// Prototype (old code that you don't have time to rewrite) 185 +document.observe('xwiki:dom:updated', function(event) { 186 + event.memo.elements.each(function(element) { 187 + // Do something. 188 + }); 189 +}); 190 +... 191 +// jQuery (new code) 192 +require(['jquery', 'xwiki-events-bridge'], function($) { 193 + $(document).trigger('xwiki:dom:updated', {'elements': $('.some-container').toArray()}); 194 +}); 195 +{{/code}} 196 + 181 181 = Get some information about the current document = 182 182 183 183 In your javascript's applications, you can get (meta) information about the current document, though an AMS module.