Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JavaScript in TYPO3 Backend, 2023
Search
Andreas Fernandez
August 05, 2023
Programming
0
500
JavaScript in TYPO3 Backend, 2023
Presentation about the state of JavaScript in the TYPO3 backend, held at TYPO3 Developer Days 2023.
Andreas Fernandez
August 05, 2023
Tweet
Share
More Decks by Andreas Fernandez
See All by Andreas Fernandez
ECMAScript killed the jQuery star - in TYPO3
andreasfernandez
0
99
JavaScript in TYPO3 Backend
andreasfernandez
0
160
Other Decks in Programming
See All in Programming
CSC305 Lecture 25
javiergs
PRO
0
130
Symfony Mapper Component
soyuka
2
730
テスト自動化失敗から再挑戦しチームにオーナーシップを委譲した話/STAC2024 macho
ma_cho29
1
1.3k
これが俺の”自分戦略” プロセスを楽しんでいこう! - Developers CAREER Boost 2024
niftycorp
PRO
0
190
선언형 UI에서의 상태관리
l2hyunwoo
0
150
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
210
フロントエンドのディレクトリ構成どうしてる? Feature-Sliced Design 導入体験談
osakatechlab
8
4.1k
テストコード文化を0から作り、変化し続けた組織
kazatohiei
2
1.5k
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
190
testcontainers のススメ
sgash708
1
120
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
110
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
222
9k
YesSQL, Process and Tooling at Scale
rocio
169
14k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
5
440
Building Your Own Lightsaber
phodgson
103
6.1k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
17
2.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
48
2.2k
Being A Developer After 40
akosma
87
590k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
810
How STYLIGHT went responsive
nonsquared
95
5.2k
Producing Creativity
orderedlist
PRO
341
39k
Transcript
JAVASCRIPT IN TYPO3, 2023 Andreas Fernandez
[email protected]
@_fernandreas TYPO3 Developer
Days 2023 August 5th, 2023
ANDREAS FERNANDEZ ▪ Core Developer since 2015 ▪ TYPO3 GmbH
since 2019 ▪ I void warranties @_fernandreas
[email protected]
AGENDA 1. jQuery 2. Module Loading 3. AJAX API 4.
Events 5. Notification API 6. Modals 7. Icons 8. Web Components
JQUERY
JQUERY ▪ Solved cross-browser issues ▪ Fast and easy development
▪ De-facto standard
JQUERY ▪ Browsers have stable APIs now ▪ Phasing out
jQuery ▪ ~50 modules left
JQUERY UI
JQUERY | JQUERY UI ▪ Huge library for rich user
interfaces ▪ TYPO3 used draggable / resizable only ▪ Top-level wrappers for low-level "API" ▪ Combination of click* / mouse* events
JQUERY | JQUERY UI ▪ Browsers have real APIs now
▪ Unused since TYPO3 v12.4.2 ▪ Removed in upcoming TYPO3 v13.0
MODULE LOADING
REQUIREJS
MODULE LOADING | REQUIREJS ▪ Foundation for separated modules ▪
Dependency handling ▪ Introduced in TYPO3 v7
None
LAST UPDATE IN 2020
MODULE LOADING | REQUIREJS ▪ Deprecated in TYPO3 v12 ▪
Removed in TYPO3 v13
ECMASCRIPT MODULES
MODULE LOADING | ECMASCRIPT MODULES ▪ Supported in all major
browsers ▪ No 3rd party dependency necessary
None
None
IMPORT MAPS
MODULE LOADING | ECMASCRIPT MODULES ▪ JSON object ▪ Maps
an identifier to a file or directory ▪ A real Highlander: there can be only one!
None
None
None
🤫
MODULE LOADING | ECMASCRIPT MODULES ▪ With import maps, identifier
paths can be defined ▪ Each extension can bring their own definition
None
MODULE LOADING | ECMASCRIPT MODULES ▪ With clever use, any
module can get overridden ▪ Same compatibility rules of XCLASSes apply ▪ Any update may break your override without prior notice
AJAX API
AJAX API ▪ Introduced in TYPO3 v10 ▪ Based on
fetch() API
https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
None
None
None
None
None
EVENTS
EVENTS ▪ TYPO3 got its own event handling API in
v10 ▪ One step further in phasing out jQuery ▪ Binding and delegation supported
EVENTS ▪ Binding: Listener for one specific node ▪ Delegation:
Listener is bound to a top node and listens to child nodes
None
None
REGULAR EVENTS
EVENTS | REGULAR EVENTS ▪ Most basic event API ▪
Wrapper for .addEventListener()
None
DEBOUNCED EVENTS
EVENTS | DEBOUNCED EVENTS ▪ Waits a defined interval (250ms
by default) before running the event listener after the last invocation ▪ Useful for heavy tasks, e.g. AJAX requests based on a search field value
None
THROTTLED EVENTS
EVENTS | THROTTLED EVENTS ▪ Runs event handler and waits
a to-be-defined interval before next execution ▪ Useful for handling that can be paused in between for performance reasons (e.g. scrolling)
None
NOTIFICATION API
NOTIFICATION API ▪ Fly-out messages informing the user about state
changes ▪ Optionally interactive
NOTIFICATION API ▪ notice(...) ▪ info(...) ▪ success(...) ▪ warning(...)
▪ danger(...)
Excerpt of notification types
NOTIFICATION API ▪ title: string ▪ message?: string ▪ duration?:
number = 5 // 0 if error ▪ actions?: Array<Action>
None
Bare minimum notification
INTERACTIVE
NOTIFICATION API ▪ Enrich notifications with actions ▪ Action must
be in context of the notification ▪ Execution must be optional ▪ Not more than three actions
NOTIFICATION API ▪ label: string ▪ action: DeferredAction|ImmediateAction
None
None
None
It's Christmas time soon!
DISPATCH NOTIFICATIONS VIA PHP
NOTIFICATION API ▪ Since TYPO3 v12, notifications can be dispatched
via PHP ▪ No support for interactions ▪ Useful e.g. in DataHandler hooks ▪ Specialized FlashMessage queue identifier ▪ Ready-to-use in ModuleTemplate API
None
MODALS
MODALS ▪ User interface blocking windows ▪ Require user interaction
MODALS ▪ confirm(...) ▪ advanced(...) ▪ show(...) ▪ loadUrl(...)
"CONFIRM" MODALS
MODALS | CONFIRM ▪ Most simple modal implementation ▪ Requires
title and content only ▪ Default severity is warning ▪ Provides "Cancel" and "OK" buttons by default
None
Confirmation modal
"ADVANCED" MODALS
MODALS | ADVANCED ▪ Gives the full capabilities of the
modal API ▪ Complex configuration
None
None
None
ICONS
ICONS ▪ TYPO3 provides a unified icon set ▪ Extensions
may provide additional icons ▪ Several APIs to access and render icons
ICONS ▪ default: 1em ▪ small: 16px ▪ medium: 32px
▪ large: 48px ▪ mega: 64px
None
ICONS ▪ Fluid ViewHelper ▪ JavaScript Module ▪ Web Component
None
None
None
None
ICONS ▪ The icon web component internally uses the JS
API ▪ Icons are requested via AJAX ▪ The markup is kept in local storage until the next TYPO3 or extension update
WEB COMPONENTS
WEB COMPONENTS ▪ Based on Lit ▪ Closest to the
Web Components Standard ▪ Reactive web components ▪ Easy templating ▪ Easy event handling
WARNING! TYPESCRIPT AHEAD!
WEB COMPONENTS ▪ Example: https://github.com/TYPO3/typo3/blob/ main/Build/Sources/TypeScript/backend/element /editable-page-title.ts
WEB COMPONENTS ▪ Lit needs decorators ▪ True power comes
with compilers (Babel, TypeScript, ...) ▪ Shadow DOM is barely usable due to Bootstrap CSS
QUESTIONS? ANDREAS FERNANDEZ @_fernandreas
[email protected]