SlideShare a Scribd company logo
Async navigation with a lightweight ES6 framework
sezioni di pagina async
con ES6 + D8 +
la “vera” storia di
Async navigation with a lightweight ES6 framework
Async navigation with a lightweight ES6 framework
INGREDIENTI
- Drupal
- Drupal.settings /
drupalSettings
- hook_menu/routing
- hook_theme (7/8)
- Sf YAML parser
- ES6 + webpack +
polyfill
- jQuery
PER CUCINARE BENE…
PERCHÉ YAML?
Fornisce, insieme ai template, un sistema abbastanza
intuitivo di impaginazione dei contenuti
PERCHÉ ES6?
* Why not? transpiler >>> compatibilità
* Contiene una discreta dose di "syntactic sugar", per
oggetti e tipi di dati di uso comune
* È più orientato a organizzare il codice a oggetti in
modi "familiari" (classi vs. prototype)
PERCHÉ ES6?
* Rende il comportamento del codice più prevedibile
rispetto alle versioni precedenti (es. scope delle var)
* Moduli
* Promises (per AJAX)
ES6: COSA ABBIAMO SFRUTTATO FINORA?
* Syntactic sugar
* Accenno di modularità
* Classi
ES6: COSA SFRUTTEREMO IN FUTURO?
* ES7 async
* Generators
* Promises
(insomma, next-gen AJAX…)
COMPONENTI DEL SISTEMA
* una rotta unica
* template pagina
* hook_theme
* YAML >>> blocchi
* GOAT-core
* JS per clic su tab
ROUTING
Una sola rotta
restituisce con JSON i
contenuti di ogni blocco.
La rotta accetta un
parametro che indica
quale blocco recuperare.
Per convenzione, il
parametro identificativo
coincide con il nome
dell’elemento di
hook_theme
THEMING
Un template per la pagina
contenitore di
destinazione delle
sezioni. Contiene tutti i
contenitori di markup che
definiscono le sezioni.
Un elemento hook_theme
per ogni blocco da
implementare, indica
quale template usare come
contenitore per i
blocchi.
CLASSI
Un’interfaccia definisce
quali metodi devono
implementare i singoli
blocchi.
Una factory provvede ad
associare ogni
identificativo di blocco
(elemento hook_theme -
vd. altra slide) con la
relativa classe.
YAML + SETTINGS
Un file YAML di
definizione di sezioni,
regioni, blocchi: viene
elaborato dalla classe
parser.
Una volta elaborata la
configurazione, viene
passata agli script
tramite drupalSettings.
-CORE
Una libreria generica che
si occupa di mostrare e
nascondere i blocchi
all’interno delle varie
sezioni.
Interagisce con i
drupalSettings.
Riceve i dati sulla
sezione da mostrare da
uno script che gestisce i
click sulle tab.
-CORE
Nella versione D7 il
codice server-side si
occupa anche di caricare
dinamicamente le librerie
eventualmente richieste
dai contenuti caricati
via AJAX, per il
funzionamento di alcuni
widget (es. i filtri
esposti AJAX di Views).
Il futuro di
* Gestione di URL che
portano direttamente a un
tab interno
* Gestione della
cronologia di navigazione
attraverso le tab
* AJAX “moderno”
(promises, ES7…)
* Possibilità di
configurare la necessità
di refresh per sezioni o
singoli blocchi
PROBLEMI E ANNOTAZIONI - ES6
* retrocompatibilità >>> transpiler + polyfill
* moduli: decidere se usare librerie fornite da Drupal
(es. jQuery come modulo >>> DEPENDENCY)
* transpiler >>> layer aggiuntivo da gestire durante
sviluppo e debug
PROBLEMI E ANNOTAZIONI - D8
* Supportare le librerie JS "di terzi" è un po' più
problematico (WIP) >>> attachment
* Obsolescenza delle librerie fornite “stock” da D8
GRAZIE!
Marcello Testi
@pinolo
marcello.testi@sparkfabrik.com
Edoardo Dusi
@edodusi
edoardo.dusi@sparkfabrik.com
Async navigation with a lightweight ES6 framework
Ad

More Related Content

Viewers also liked (10)

Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
sparkfabrik
 
REST in pieces
REST in piecesREST in pieces
REST in pieces
sparkfabrik
 
Frontend asset management with Bower and Gulp.js
Frontend asset management with Bower and Gulp.jsFrontend asset management with Bower and Gulp.js
Frontend asset management with Bower and Gulp.js
Renan Gonçalves
 
Managing packages with Bower and NuGet in ASP.NET Core
Managing packages with Bower and NuGet in ASP.NET CoreManaging packages with Bower and NuGet in ASP.NET Core
Managing packages with Bower and NuGet in ASP.NET Core
Philip Domingo
 
WordPress - Perusteet
WordPress - PerusteetWordPress - Perusteet
WordPress - Perusteet
Frantic
 
Drupal day Roma 2017 - Zaratan
Drupal day Roma 2017 - Zaratan Drupal day Roma 2017 - Zaratan
Drupal day Roma 2017 - Zaratan
r3vit
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
Diversifying cellular for massive IoT
Diversifying cellular for massive IoTDiversifying cellular for massive IoT
Diversifying cellular for massive IoT
Ericsson
 
Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8
Pantheon
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
Pantheon
 
Drupal 8: frontend development
Drupal 8: frontend developmentDrupal 8: frontend development
Drupal 8: frontend development
sparkfabrik
 
Frontend asset management with Bower and Gulp.js
Frontend asset management with Bower and Gulp.jsFrontend asset management with Bower and Gulp.js
Frontend asset management with Bower and Gulp.js
Renan Gonçalves
 
Managing packages with Bower and NuGet in ASP.NET Core
Managing packages with Bower and NuGet in ASP.NET CoreManaging packages with Bower and NuGet in ASP.NET Core
Managing packages with Bower and NuGet in ASP.NET Core
Philip Domingo
 
WordPress - Perusteet
WordPress - PerusteetWordPress - Perusteet
WordPress - Perusteet
Frantic
 
Drupal day Roma 2017 - Zaratan
Drupal day Roma 2017 - Zaratan Drupal day Roma 2017 - Zaratan
Drupal day Roma 2017 - Zaratan
r3vit
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Matthew Davis
 
Diversifying cellular for massive IoT
Diversifying cellular for massive IoTDiversifying cellular for massive IoT
Diversifying cellular for massive IoT
Ericsson
 
Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8Best Practice Site Architecture in Drupal 8
Best Practice Site Architecture in Drupal 8
Pantheon
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
Pantheon
 

Similar to Async navigation with a lightweight ES6 framework (20)

Introduzione a google_app_engine_datastore
Introduzione a google_app_engine_datastoreIntroduzione a google_app_engine_datastore
Introduzione a google_app_engine_datastore
firenze-gtug
 
Programmazione mobile: ANDROID
Programmazione mobile: ANDROIDProgrammazione mobile: ANDROID
Programmazione mobile: ANDROID
Paolo Tosato
 
MongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework MeetingMongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework Meeting
guest67beeb9
 
MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009
Massimiliano Dessì
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009
Massimiliano Dessì
 
MySQL 5
MySQL 5MySQL 5
MySQL 5
jekil
 
SQLite in Xamarin.Forms
SQLite in Xamarin.FormsSQLite in Xamarin.Forms
SQLite in Xamarin.Forms
Guido Magrin
 
MongoDB
MongoDBMongoDB
MongoDB
NaLUG
 
DNM19 Sessione2 Orchard Temi e Layout (Ita)
DNM19 Sessione2 Orchard Temi e Layout (Ita)DNM19 Sessione2 Orchard Temi e Layout (Ita)
DNM19 Sessione2 Orchard Temi e Layout (Ita)
Alessandro Giorgetti
 
DotNetToscana - Sessione TypeScript
DotNetToscana - Sessione TypeScriptDotNetToscana - Sessione TypeScript
DotNetToscana - Sessione TypeScript
Sinergia Totale
 
ASP.NET Core - Razor Pages
ASP.NET Core - Razor PagesASP.NET Core - Razor Pages
ASP.NET Core - Razor Pages
Andrea Dottor
 
Xml annessi e connessi
Xml annessi e connessiXml annessi e connessi
Xml annessi e connessi
Domenico Briganti
 
SmartClient by Isomorphic - Rich internet applications
SmartClient by Isomorphic - Rich internet applicationsSmartClient by Isomorphic - Rich internet applications
SmartClient by Isomorphic - Rich internet applications
Claudio Bosticco
 
DDive - 8.5.2 Xpages - L'evoluzione continua
DDive - 8.5.2 Xpages - L'evoluzione continuaDDive - 8.5.2 Xpages - L'evoluzione continua
DDive - 8.5.2 Xpages - L'evoluzione continua
Dominopoint - Italian Lotus User Group
 
Py a6 python-database
Py a6 python-databasePy a6 python-database
Py a6 python-database
Majong DevJfu
 
Struttin' on, novità in casa Struts
Struttin' on, novità in casa StrutsStruttin' on, novità in casa Struts
Struttin' on, novità in casa Struts
Marcello Teodori
 
X-NERVal e Component NER
X-NERVal e Component NERX-NERVal e Component NER
X-NERVal e Component NER
skasof
 
MySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle Openstack
MySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle OpenstackMySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle Openstack
MySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle Openstack
Par-Tec S.p.A.
 
Introduzione a google_app_engine_datastore
Introduzione a google_app_engine_datastoreIntroduzione a google_app_engine_datastore
Introduzione a google_app_engine_datastore
firenze-gtug
 
Programmazione mobile: ANDROID
Programmazione mobile: ANDROIDProgrammazione mobile: ANDROID
Programmazione mobile: ANDROID
Paolo Tosato
 
MongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework MeetingMongoDb and Scala SpringFramework Meeting
MongoDb and Scala SpringFramework Meeting
guest67beeb9
 
MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009MongoDB Scala Roma SpringFramework Meeting2009
MongoDB Scala Roma SpringFramework Meeting2009
Massimiliano Dessì
 
MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009MongoDB SpringFramework Meeting september 2009
MongoDB SpringFramework Meeting september 2009
Massimiliano Dessì
 
MySQL 5
MySQL 5MySQL 5
MySQL 5
jekil
 
SQLite in Xamarin.Forms
SQLite in Xamarin.FormsSQLite in Xamarin.Forms
SQLite in Xamarin.Forms
Guido Magrin
 
MongoDB
MongoDBMongoDB
MongoDB
NaLUG
 
DNM19 Sessione2 Orchard Temi e Layout (Ita)
DNM19 Sessione2 Orchard Temi e Layout (Ita)DNM19 Sessione2 Orchard Temi e Layout (Ita)
DNM19 Sessione2 Orchard Temi e Layout (Ita)
Alessandro Giorgetti
 
DotNetToscana - Sessione TypeScript
DotNetToscana - Sessione TypeScriptDotNetToscana - Sessione TypeScript
DotNetToscana - Sessione TypeScript
Sinergia Totale
 
ASP.NET Core - Razor Pages
ASP.NET Core - Razor PagesASP.NET Core - Razor Pages
ASP.NET Core - Razor Pages
Andrea Dottor
 
SmartClient by Isomorphic - Rich internet applications
SmartClient by Isomorphic - Rich internet applicationsSmartClient by Isomorphic - Rich internet applications
SmartClient by Isomorphic - Rich internet applications
Claudio Bosticco
 
Py a6 python-database
Py a6 python-databasePy a6 python-database
Py a6 python-database
Majong DevJfu
 
Struttin' on, novità in casa Struts
Struttin' on, novità in casa StrutsStruttin' on, novità in casa Struts
Struttin' on, novità in casa Struts
Marcello Teodori
 
X-NERVal e Component NER
X-NERVal e Component NERX-NERVal e Component NER
X-NERVal e Component NER
skasof
 
MySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle Openstack
MySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle OpenstackMySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle Openstack
MySQL Tech Tour 2016 - Database-as-a-Service con MySQL e Oracle Openstack
Par-Tec S.p.A.
 
Ad

More from sparkfabrik (20)

Talks on my machine: Drupal, Storybook e SDC
Talks on my machine: Drupal, Storybook e SDCTalks on my machine: Drupal, Storybook e SDC
Talks on my machine: Drupal, Storybook e SDC
sparkfabrik
 
Talks on my machine: Drupal CMS versus The Cool Kids
Talks on my machine: Drupal CMS versus The Cool KidsTalks on my machine: Drupal CMS versus The Cool Kids
Talks on my machine: Drupal CMS versus The Cool Kids
sparkfabrik
 
Talks on my machine: Drupal: AI e Typesense come integrare la ricerca semantica
Talks on my machine:  Drupal: AI e Typesense come integrare la ricerca semanticaTalks on my machine:  Drupal: AI e Typesense come integrare la ricerca semantica
Talks on my machine: Drupal: AI e Typesense come integrare la ricerca semantica
sparkfabrik
 
KCD Italy 2023 - Secure Software Supply chain for OCI Artifact on Kubernetes
KCD Italy 2023 - Secure Software Supply chain for OCI Artifact on KubernetesKCD Italy 2023 - Secure Software Supply chain for OCI Artifact on Kubernetes
KCD Italy 2023 - Secure Software Supply chain for OCI Artifact on Kubernetes
sparkfabrik
 
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik
 
IAD 2023 - 22 Years of Agile and all I got is this lousy t-shirt
IAD 2023 - 22 Years of Agile and all I got is this lousy t-shirtIAD 2023 - 22 Years of Agile and all I got is this lousy t-shirt
IAD 2023 - 22 Years of Agile and all I got is this lousy t-shirt
sparkfabrik
 
2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages
sparkfabrik
 
2023 - TAC23 - Agile HR - Racconti dal fronte
2023 - TAC23 - Agile HR - Racconti dal fronte2023 - TAC23 - Agile HR - Racconti dal fronte
2023 - TAC23 - Agile HR - Racconti dal fronte
sparkfabrik
 
CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...
CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...
CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...
sparkfabrik
 
What is the Secure Supply Chain and the Current State of the PHP Ecosystem
What is the Secure Supply Chain and the Current State of the PHP EcosystemWhat is the Secure Supply Chain and the Current State of the PHP Ecosystem
What is the Secure Supply Chain and the Current State of the PHP Ecosystem
sparkfabrik
 
UX e Web sostenibile (UXday 2023).pdf
UX e Web sostenibile (UXday 2023).pdfUX e Web sostenibile (UXday 2023).pdf
UX e Web sostenibile (UXday 2023).pdf
sparkfabrik
 
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
sparkfabrik
 
Deep dive nella supply chain della nostra infrastruttura cloud
Deep dive nella supply chain della nostra infrastruttura cloudDeep dive nella supply chain della nostra infrastruttura cloud
Deep dive nella supply chain della nostra infrastruttura cloud
sparkfabrik
 
KCD Italy 2022 - Application driven infrastructure with Crossplane
KCD Italy 2022 - Application driven infrastructure with CrossplaneKCD Italy 2022 - Application driven infrastructure with Crossplane
KCD Italy 2022 - Application driven infrastructure with Crossplane
sparkfabrik
 
Come Drupal costruisce le tue pagine
Come Drupal costruisce le tue pagineCome Drupal costruisce le tue pagine
Come Drupal costruisce le tue pagine
sparkfabrik
 
Drupal 10: un framework PHP di sviluppo Cloud Native moderno
Drupal 10: un framework PHP di sviluppo Cloud Native modernoDrupal 10: un framework PHP di sviluppo Cloud Native moderno
Drupal 10: un framework PHP di sviluppo Cloud Native moderno
sparkfabrik
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
sparkfabrik
 
Do you know what your Drupal is doing_ Observe it!
Do you know what your Drupal is doing_ Observe it!Do you know what your Drupal is doing_ Observe it!
Do you know what your Drupal is doing_ Observe it!
sparkfabrik
 
Progettare e sviluppare soluzioni serverless con AWS
Progettare e sviluppare soluzioni serverless con AWSProgettare e sviluppare soluzioni serverless con AWS
Progettare e sviluppare soluzioni serverless con AWS
sparkfabrik
 
From React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I startedFrom React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I started
sparkfabrik
 
Talks on my machine: Drupal, Storybook e SDC
Talks on my machine: Drupal, Storybook e SDCTalks on my machine: Drupal, Storybook e SDC
Talks on my machine: Drupal, Storybook e SDC
sparkfabrik
 
Talks on my machine: Drupal CMS versus The Cool Kids
Talks on my machine: Drupal CMS versus The Cool KidsTalks on my machine: Drupal CMS versus The Cool Kids
Talks on my machine: Drupal CMS versus The Cool Kids
sparkfabrik
 
Talks on my machine: Drupal: AI e Typesense come integrare la ricerca semantica
Talks on my machine:  Drupal: AI e Typesense come integrare la ricerca semanticaTalks on my machine:  Drupal: AI e Typesense come integrare la ricerca semantica
Talks on my machine: Drupal: AI e Typesense come integrare la ricerca semantica
sparkfabrik
 
KCD Italy 2023 - Secure Software Supply chain for OCI Artifact on Kubernetes
KCD Italy 2023 - Secure Software Supply chain for OCI Artifact on KubernetesKCD Italy 2023 - Secure Software Supply chain for OCI Artifact on Kubernetes
KCD Italy 2023 - Secure Software Supply chain for OCI Artifact on Kubernetes
sparkfabrik
 
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik
 
IAD 2023 - 22 Years of Agile and all I got is this lousy t-shirt
IAD 2023 - 22 Years of Agile and all I got is this lousy t-shirtIAD 2023 - 22 Years of Agile and all I got is this lousy t-shirt
IAD 2023 - 22 Years of Agile and all I got is this lousy t-shirt
sparkfabrik
 
2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages2023 - Drupalcon - How Drupal builds your pages
2023 - Drupalcon - How Drupal builds your pages
sparkfabrik
 
2023 - TAC23 - Agile HR - Racconti dal fronte
2023 - TAC23 - Agile HR - Racconti dal fronte2023 - TAC23 - Agile HR - Racconti dal fronte
2023 - TAC23 - Agile HR - Racconti dal fronte
sparkfabrik
 
CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...
CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...
CodeMotion 2023 - Deep dive nella supply chain della nostra infrastruttura cl...
sparkfabrik
 
What is the Secure Supply Chain and the Current State of the PHP Ecosystem
What is the Secure Supply Chain and the Current State of the PHP EcosystemWhat is the Secure Supply Chain and the Current State of the PHP Ecosystem
What is the Secure Supply Chain and the Current State of the PHP Ecosystem
sparkfabrik
 
UX e Web sostenibile (UXday 2023).pdf
UX e Web sostenibile (UXday 2023).pdfUX e Web sostenibile (UXday 2023).pdf
UX e Web sostenibile (UXday 2023).pdf
sparkfabrik
 
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
Drupal Dev Days Vienna 2023 - What is the secure software supply chain and th...
sparkfabrik
 
Deep dive nella supply chain della nostra infrastruttura cloud
Deep dive nella supply chain della nostra infrastruttura cloudDeep dive nella supply chain della nostra infrastruttura cloud
Deep dive nella supply chain della nostra infrastruttura cloud
sparkfabrik
 
KCD Italy 2022 - Application driven infrastructure with Crossplane
KCD Italy 2022 - Application driven infrastructure with CrossplaneKCD Italy 2022 - Application driven infrastructure with Crossplane
KCD Italy 2022 - Application driven infrastructure with Crossplane
sparkfabrik
 
Come Drupal costruisce le tue pagine
Come Drupal costruisce le tue pagineCome Drupal costruisce le tue pagine
Come Drupal costruisce le tue pagine
sparkfabrik
 
Drupal 10: un framework PHP di sviluppo Cloud Native moderno
Drupal 10: un framework PHP di sviluppo Cloud Native modernoDrupal 10: un framework PHP di sviluppo Cloud Native moderno
Drupal 10: un framework PHP di sviluppo Cloud Native moderno
sparkfabrik
 
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
Do you know what your Drupal is doing Observe it! (DrupalCon Prague 2022)
sparkfabrik
 
Do you know what your Drupal is doing_ Observe it!
Do you know what your Drupal is doing_ Observe it!Do you know what your Drupal is doing_ Observe it!
Do you know what your Drupal is doing_ Observe it!
sparkfabrik
 
Progettare e sviluppare soluzioni serverless con AWS
Progettare e sviluppare soluzioni serverless con AWSProgettare e sviluppare soluzioni serverless con AWS
Progettare e sviluppare soluzioni serverless con AWS
sparkfabrik
 
From React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I startedFrom React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I started
sparkfabrik
 
Ad

Async navigation with a lightweight ES6 framework

  • 2. sezioni di pagina async con ES6 + D8 +
  • 6. INGREDIENTI - Drupal - Drupal.settings / drupalSettings - hook_menu/routing - hook_theme (7/8) - Sf YAML parser - ES6 + webpack + polyfill - jQuery
  • 8. PERCHÉ YAML? Fornisce, insieme ai template, un sistema abbastanza intuitivo di impaginazione dei contenuti
  • 9. PERCHÉ ES6? * Why not? transpiler >>> compatibilità * Contiene una discreta dose di "syntactic sugar", per oggetti e tipi di dati di uso comune * È più orientato a organizzare il codice a oggetti in modi "familiari" (classi vs. prototype)
  • 10. PERCHÉ ES6? * Rende il comportamento del codice più prevedibile rispetto alle versioni precedenti (es. scope delle var) * Moduli * Promises (per AJAX)
  • 11. ES6: COSA ABBIAMO SFRUTTATO FINORA? * Syntactic sugar * Accenno di modularità * Classi
  • 12. ES6: COSA SFRUTTEREMO IN FUTURO? * ES7 async * Generators * Promises (insomma, next-gen AJAX…)
  • 13. COMPONENTI DEL SISTEMA * una rotta unica * template pagina * hook_theme * YAML >>> blocchi * GOAT-core * JS per clic su tab
  • 14. ROUTING Una sola rotta restituisce con JSON i contenuti di ogni blocco. La rotta accetta un parametro che indica quale blocco recuperare. Per convenzione, il parametro identificativo coincide con il nome dell’elemento di hook_theme
  • 15. THEMING Un template per la pagina contenitore di destinazione delle sezioni. Contiene tutti i contenitori di markup che definiscono le sezioni. Un elemento hook_theme per ogni blocco da implementare, indica quale template usare come contenitore per i blocchi.
  • 16. CLASSI Un’interfaccia definisce quali metodi devono implementare i singoli blocchi. Una factory provvede ad associare ogni identificativo di blocco (elemento hook_theme - vd. altra slide) con la relativa classe.
  • 17. YAML + SETTINGS Un file YAML di definizione di sezioni, regioni, blocchi: viene elaborato dalla classe parser. Una volta elaborata la configurazione, viene passata agli script tramite drupalSettings.
  • 18. -CORE Una libreria generica che si occupa di mostrare e nascondere i blocchi all’interno delle varie sezioni. Interagisce con i drupalSettings. Riceve i dati sulla sezione da mostrare da uno script che gestisce i click sulle tab.
  • 19. -CORE Nella versione D7 il codice server-side si occupa anche di caricare dinamicamente le librerie eventualmente richieste dai contenuti caricati via AJAX, per il funzionamento di alcuni widget (es. i filtri esposti AJAX di Views).
  • 20. Il futuro di * Gestione di URL che portano direttamente a un tab interno * Gestione della cronologia di navigazione attraverso le tab * AJAX “moderno” (promises, ES7…) * Possibilità di configurare la necessità di refresh per sezioni o singoli blocchi
  • 21. PROBLEMI E ANNOTAZIONI - ES6 * retrocompatibilità >>> transpiler + polyfill * moduli: decidere se usare librerie fornite da Drupal (es. jQuery come modulo >>> DEPENDENCY) * transpiler >>> layer aggiuntivo da gestire durante sviluppo e debug
  • 22. PROBLEMI E ANNOTAZIONI - D8 * Supportare le librerie JS "di terzi" è un po' più problematico (WIP) >>> attachment * Obsolescenza delle librerie fornite “stock” da D8