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
520
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
170
Other Decks in Programming
See All in Programming
Azure AI Foundryのご紹介
qt_luigi
1
210
Fibonacci Function Gallery - Part 2
philipschwarz
PRO
0
210
HTML/CSS超絶浅い説明
yuki0329
0
190
ドメインイベント増えすぎ問題
h0r15h0
2
560
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
[JAWS-UG横浜 #80] うわっ…今年のServerless アップデート、少なすぎ…?
maroon1st
0
100
Simple組み合わせ村から大都会Railsにやってきた俺は / Coming to Rails from the Simple
moznion
3
2.1k
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
1.9k
return文におけるstd::moveについて
onihusube
1
1.4k
ASP.NET Core の OpenAPIサポート
h455h1
0
120
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
1.3k
React 19でお手軽にCSS-in-JSを自作する
yukukotani
5
560
Featured
See All Featured
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
Faster Mobile Websites
deanohume
305
30k
Speed Design
sergeychernyshev
25
740
Navigating Team Friction
lara
183
15k
RailsConf 2023
tenderlove
29
970
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
A Philosophy of Restraint
colly
203
16k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
Measuring & Analyzing Core Web Vitals
bluesmoon
5
210
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
240
How to Ace a Technical Interview
jacobian
276
23k
Practical Orchestrator
shlominoach
186
10k
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]