From version 12.1
edited by Krzysztof Płachno
on 2017/08/24 13:04
To version 13.1
edited by Krzysztof Płachno
on 2017/08/24 13:07
Change comment: There is no comment for this version

Summary

Details

ExtensionCode.ExtensionClass[0]
Description
... ... @@ -15,6 +15,7 @@
15 15  {{image reference="simpleSearch.PNG" width="600px"/}}
16 16  
17 17  Then choose the #mathjs# from the the result list and choosing option "Install on farm" proceed to install it as you'd do for any XWiki extension:
18 +
18 18  {{image reference="install.PNG" width="600px"/}}
19 19  
20 20  
... ... @@ -21,11 +21,14 @@
21 21  === Skin Extension using ##mathjs## ===
22 22  
23 23  To see your imported JS library in action you may create [[JavaScript Skin Extension>>Skin Extension Plugin]] (a.k.a ##jsx##). To get to know how to create such extension refer to [[Skin Extension Tutorial>>platform:DevGuide.SkinExtensionsTutorial]] particularly to [[Minimal JavaScript eXtension >>http://platform.xwiki.org/xwiki/bin/view/DevGuide/SkinExtensionsTutorial#HMyfirstSkineXtension]] guide.
24 -Create this Minimal JavaScript eXtension as described in tutorial and then replace #Code section with following snippet:
25 -{{code language="JS"}}require(["$services.webjars.url('mathjs/3.16.2/dist/math.js')"], function(math){
25 +Create this Minimal JavaScript eXtension as described in tutorial and then replace ##Code## section with following snippet:
26 +
27 +{{code language="JS"}}
28 +require(["$services.webjars.url('mathjs/3.16.2/dist/math.js')"], function(math){
26 26   var res = math.sqrt(-4);
27 27   alert("Square root of -4 is: " + res);
28 -});{{/code}}
31 +});
32 +{{/code}}
29 29  
30 30  {{info}}
31 31  You'll find more information about syntax of importing JS libraries into Skin Extensions code on [[WebJars API>>Extension.WebJars Integration]] page.
... ... @@ -32,4 +32,5 @@
32 32  {{/info}}
33 33  
34 34  When you refresh your page as the result you should see alert popup with text more less like following:
39 +
35 35  {{image reference="result.PNG" width="600px"/}}

Get Connected