File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 .reveal {
4141 font-size : 30px ;
4242 }
43+ .multicol {
44+ display : flex;
45+ }
46+ .col {
47+ flex : 1 ;
48+ }
4349 </ style >
4450</ head >
4551
@@ -103,7 +109,6 @@ <h1>Transpilage</h1>
103109 </ ul >
104110 </ section >
105111 </ section >
106-
107112 < section id ="part-2 ">
108113 < section >
109114 < h1 > Les bases</ h1 >
@@ -935,14 +940,57 @@ <h2>La preuve en live...</h2>
935940
936941 < section id ="part-5 ">
937942 < section >
938- < h1 > Structure d'une application</ h1 >
943+ < h1 > Structure applicative</ h1 >
944+ < p > Une application SPA est composée de plusieurs fichiers javascripts. C'est quand même plus pratique pour coder!</ p >
945+ < p > On découpe donc une application en modules</ p >
946+ < div class ="multicol ">
947+ < div class ="col "> < img src ="./images/structure-application.PNG "/> </ div >
948+ < div class ="col "> < img src ="./images/structure-application-2.PNG "/> </ div >
949+ </ div >
939950 </ section >
940951 < section >
941- < h1 > Déclarer un module</ h1 >
952+ < h1 > Module avant ES6</ h1 >
953+ < p > Les modules javascripts permettent d'isoler votre code du reste de l'application. D'organiser votre code, d'éviter les collision de noms etc.</ p >
954+ < pre > < code class ="javascript ">
955+ /// fichier1.js
956+ const private = 5;
957+ const monObjet = {
958+ name: "lala",
959+ age: 42 + private,
960+
961+ }
962+
963+ module.exports = monObjet;
964+
965+ /// fichier2.js
966+ const lala = require('./fichier1.js');
967+ lala.awesomeness; // true;
968+ private; // undefined
969+ lala.age; // 47
970+ </ code > </ pre >
942971 </ section >
943972 < section >
944- < h1 > Utiliser un module</ h1 >
945- </ section >
973+ < h1 > Module depuis ES6</ h1 >
974+ < p > Il est possible d'exporter plusieurs variables au sein d'un même fichier en les nommant.</ p >
975+ < pre > < code class ="javascript ">
976+ /// fichier1.js
977+ export monObjet = {
978+ name: "lala",
979+ age: 42
980+ }
981+
982+ export monObjet2 = {
983+ name: "lola",
984+ age: 8
985+ }
986+
987+ /// fichier2.js
988+ import {monObjet, monObjet2 as renommage} from "./fichier1.js";
989+
990+ monObjet.age; // 42
991+ renommage.age; // 8
992+ </ code > </ pre >
993+ </ section >
946994 </ section >
947995
948996 < section id ="part-6 ">
You can’t perform that action at this time.
0 commit comments