<
From version < 19.1 >
edited by Caleb James DeLisle
on 2013/12/05
To version < 20.1 >
edited by Guillaume Delhumeau
on 2014/10/27
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.CalebJamesDeLisle
1 +XWiki.gdelhumeau
Content
... ... @@ -161,3 +161,18 @@
161 161  {{/code}}
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 +
165 += Get some informations about the current document =
166 +
167 +In your javascript's applications, you can get some (meta) informations about the current document, though an AMS module.
168 +{{code language="javascript"}}
169 +require(['xwiki-meta'], function (xm) {
170 + xm.document // get he current document (eg: Main.WebHome)
171 + xm.xwiki // get the current wiki (eg: xwiki)
172 + xm.space // get the current space (eg: Main)
173 + xm.page // get the current page name (eg: WebHome)
174 + xm.version // get the current document version (eg: 1.1)
175 + xm.restURL // get the REST url of the current doc (eg: /xwiki/rest/wikis/xwiki/spaces/Main/pages/WebHome)
176 + xm.form_token // get the current CSRF token that ou should pass to your script's to avoid CSRF attacks.
177 +});
178 +{{/code}}

Get Connected