SlideShare ist ein Scribd-Unternehmen logo
1 von 59
Downloaden Sie, um offline zu lesen
APIsNow, and in the future
chris mills, mozillA
Get the slides!
•Don’t worry about notes
•You can get the slides from slideshare.net/
chrisdavidmills
•Sit back and relax
•Or fidget if you get bored…
•Ask questions at @chrisdavidmills or
cmills@mozilla.com
who am i?
•I’m Chris
•Mozilla, MDN writer
•Twiddling around with JS/CSS/HTML
•Firefox OS and APIs
•Guerrilla education
•Accessibility whiner
•Heavy metal drummer
APIslike, what are we talking about?
•I really mean browser JavaScript APIs
•Exposing complex functionality to JS
•Making the Web more powerful and useful
api, why oh why?
•For a time, we only really had a few APIs
•We had DOM stuff, and XHR
•(And a bunch of horrid non-standard stuff)
•But the scene exploded
•WHATWG, Web Apps WG, and others
api, why oh why?
•Earlier APIs added interesting new features
•E.g. Geolocation, Canvas
•But this still wasn’t enough
api, why oh why?
•We want to remain competitive with native
•Get everything working together more
cohesively
•Work offline ;-)
•Deal with multimedia effectively in the
browser
•Improve performance, for games, etc.
•Improve internationalization
api, why oh why?
•New ECMAScript 6 features shaping APIs
•None more so than promises — async
operations very important
•(and maybe typed arrays)
ES6 mention
myFunction().then(function(value) { 

return my2ndFunction(value);

}).then(function(value) {

// do something else with new value

}).catch(function(err) {

console.log(err);

});
promise me this
catching native
apps, device apis, etc.
•Native platforms had better functionality
•Hardware access
•Offline
•Access to core functionality
•We wanted to catch up
•And make it webby
web versus native
•We made this Firefox OS thing
•To show what a web-based OS could be like
•We invented a bunch of APIs
•For fast iteration
•To get to market on time
•Browsers never had access

to much of this before
firefox os
•Telephony/SMS/MMS
•Bluetooth/NFC
•Browser
•FMRadio, TV
•Camera, Contacts
•Device storage, Data store
•Settings, installation
•etc, etc.
proprietary apis
•manifest.webapp file defines app
•Including permissions for sensitive APIs
•Web apps
•Privileged
•Certified (internal)
installing apps
manifest{
"version": "0.1",
"name": "To-do alarms",
"description": "My awesome open web app",
"launch_path": "/index.html",
"icons": {
"128": "/img/icon-128.png"
},
"developer": {
"name": "Chris Mills",
"url": "http://yourawesomeapp.com"
},
"permissions": {
"desktop-notification" : {
"description": "Required to fire notifications"
},
"alarms": {
"description": "Required to schedule alarms"
}
},
"messages": [
{ "alarm": "/index.html" },
{ "notification": "/index.html" }
]
}
var install =
navigator.mozApps.install(manifest_url);
install.onsuccess = function(data) {
// App is installed
};

install.onerror = function() {
// App wasn't installed, info is in
// install.error.name
alert(install.error.name);
};
Installing an app
•Fortunately device API features are
gradually starting to become standardized
•We are implementing these things as they
are available
going standard
•Geolocation
•Device orientation
•Notifications
•Vibration
•WebRTC/gUM for capturing media
•Storage mechanisms (e.g. IndexedDB)
•Battery Status
some things work
•WebNFC
•Web Bluetooth
•Service workers for offline (+ other stuff)
•Manifest files
•Permissions API
•Web Speech API
coming soon
•The Web is a good thing
•Progressive enhancement
•No app stores
•You can’t progressively enhance on native,
or cache seamlessly, or render text easily
we love web
•Next version of Firefox OS to be more
webby
•Rather than trying to be native apps
•Embracing the Web’s security model
•Pin the Web
•Save state
•Packaged apps?
new plan
offlinestill a problem?
No connection = no experience
•Especially on mobile
•Offline data storage
•Offline asset storage
•Reacting to network changes
offline is hard
•Not so bad
•We have storage mechanisms (e.g.
IndexedDB, Web Storage, WebSQL)
•Something available in most browsers
•Plus polyfills (e.g. LocalForage)
offline data
•More of a pain
•Firefox OS packaged apps installed and
available offline
•This doesn’t help the web at large
•We had AppCache…
offline assets
CACHE MANIFEST
# v1
CACHE:
css/app.css
index.html
js/main.js
js/lib/require.js
this had promise
•It’s actually fairly useless
•Too much voodoo…
•Assumed a specific set of behaviours
but….
Hello service workers!
•Proxy servers that sit between app and
network
•Intercepting network requests and
customising responses
•Does similar things to AppCache (plus a lot
more…much harder to use)
•Granular control over actions
sw are cool
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw-test/sw.js', {
scope: '/*'
}).then(function(sw) {
// registration worked
console.log('Registration succeeded.');
}).catch(function() {
// registration failed
console.log('Registration failed.');
});
}
registration
this.addEventListener('install', function(event) {
event.waitUntil(
caches.create('v1').then(function(cache) {
return cache.add(
'/sw-test/',
'/sw-test/index.html',
'/sw-test/style.css',
'/sw-test/app.js',
'/sw-test/image-list.js',
'/sw-test/star-wars-logo.jpg'
// etc.
);
})
);
});

installation
this.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request).catch(function() {
return caches.get('v1').then(function(cache) {
cache.add(event.request);
return event.default();
});
}).catch(function() {
return caches.match('/sw-test/gallery/
myLittleVader.jpg');
})
);
});

custom responses
continuityspecs working together
•Creating extra work, repetition, and
confusion
•E.g. CSS and SVG functionality overlap
•Led to them forming the FXTF
•More care taken these days
•Extensible web manifesto — modular and
explainable
silos aren’t cool
•Fetch is a good example
•Similar to what XHR does
•Abstracts the whole request/response model
as JS objects
•So it can be used with other APIs like
Service Workers
fetch / sw
•Other specs also work well with/are based
on SW:
•Notifications API
•Push API
•Channel Messaging
•They all contain partial additions for SW
sw add-ons
navigator.serviceWorker.ready.then(function(reg) {
reg.pushManager.getSubscription()

.then(function(subscription) {
// Enable any UI for subscribing to push messages.
var endpoint = subscription.endpoint;
updateStatus(endpoint,'init');
}).catch(function(err) {
console.log('Error during getSubscription()', err);
});
});

push
self.addEventListener('push', function(event) { 

event.waitUntil(
self.registration.showNotification(title, {
body: body,
icon: icon,
tag: tag
})
);

});

notifications
var channel = new MessageChannel();
channel.port1.onmessage = function(e) {
alert(e.data);
}
mySW = reg.active;
mySW.postMessage('hello', [channel.port2]);

channel msg
self.onmessage = function(e) {
port = e.ports[0];
}



port.postMessage(‘hello');

•Web components
•Readable streams
other points
mediaweb audio visuals
•Media was broken for years on the Web
•Audio/video delivery needed Flash for so
long
•The <video> tag took long enough
fix media
•We already mentioned WebRTC/gUM
•Should solve many use cases, from simple
image and video capture to video
conferencing
•What about recording?
•Media Recorder API
media capture
var constraints = { audio: true, video: true };
var onSuccess = function(stream) {
// do stuff with your media stream
};
var onError = function(err) {
console.log('The following error occurred: ' + err);
}
navigator.getUserMedia(constraints, onSuccess,
onError);
getusermedia
var mediaRecorder = new MediaRecorder(stream);
record.onclick = function() {
mediaRecorder.start();
}
stop.onclick = function() {
mediaRecorder.stop();
}
mediaRecorder.ondataavailable = function(e) {
var audio = document.createElement('audio');
audio.setAttribute('controls', '');
var audioURL = window.URL.createObjectURL(e.data);
audio.src = audioURL;
}
media recorder
•Media Source Extensions
•Encrypted Media Extensions
•DRM on the Web?!?
•A necessary evil, WRT services like
Netflix..?
•Netflix involved in both the above specs
streaming/drm
•Web Audio API
•Precise audio control
•Add effects
•Split and merge audio channels
•Spatialization
•Audio visualizations
•WebMIDI coming too…
audio processing
Performancefaster and faster…
•General performance much improved
•Web Workers
•Emscripten/asm.js
•WebGL
•SIMD
•WebVR (mozvr.com also good)
performance
I18ninternationalization
•The Web is international
•But adapting sites for an intl. audience is a
pain
•E.g. Dealing with time/date formats
•And BIDI websites
•But we are working on this too
i18n
var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(new Intl.DateTimeFormat().format(date));

console.log(new Intl.DateTimeFormat('en-
US').format(date));



// DateTimeFormat without arguments returns the

// correct value for the language/timezone.
JavaScript i18n api
•The JS Internationalization API provides
features for formatting dates/times for
different languages, etc.
#content {
padding-left: 12px:
margin-right: 20px;
}

html[dir="rtl"] #content {
padding-left: 0;
padding-right: 12px;
margin-left: 20px;
margin-right: 0;
}
CSS BIDI features
•BIDI websites are simpler to layout with CSS
BIDI features
#content {
padding-inline-start: 12px:
margin-inline-end: 20px;
}
CSS BIDI features
FinitoThanks for listening!
chris mills, mozillA@chrisdavidmills, cmills@mozilla.com
•Main image: Bokeh Dandelion, by Nicolas
Raymond
credits

Weitere ähnliche Inhalte

Was ist angesagt?

HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedPeter Lubbers
 
Performance on the Yahoo! Homepage
Performance on the Yahoo! HomepagePerformance on the Yahoo! Homepage
Performance on the Yahoo! HomepageNicholas Zakas
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript FrameworkAll Things Open
 
An Introduction to webOS
An Introduction to webOSAn Introduction to webOS
An Introduction to webOSKevin Decker
 
High Performance JavaScript (YUIConf 2010)
High Performance JavaScript (YUIConf 2010)High Performance JavaScript (YUIConf 2010)
High Performance JavaScript (YUIConf 2010)Nicholas Zakas
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsChris Love
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackIgnacio Martín
 
Getting Started with HTML 5 Web workers
Getting Started with HTML 5 Web workersGetting Started with HTML 5 Web workers
Getting Started with HTML 5 Web workersFlumes
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsRyan Weaver
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015Chang W. Doh
 
Building Cross Platform Apps with Electron
Building Cross Platform Apps with ElectronBuilding Cross Platform Apps with Electron
Building Cross Platform Apps with ElectronChris Ward
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...David Kaneda
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup PerformanceJustin Cataldo
 
High Performance JavaScript - Fronteers 2010
High Performance JavaScript - Fronteers 2010High Performance JavaScript - Fronteers 2010
High Performance JavaScript - Fronteers 2010Nicholas Zakas
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup PerformanceGreg Whalin
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs SilverlightMatt Casto
 

Was ist angesagt? (19)

HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
 
Performance on the Yahoo! Homepage
Performance on the Yahoo! HomepagePerformance on the Yahoo! Homepage
Performance on the Yahoo! Homepage
 
Choosing a Javascript Framework
Choosing a Javascript FrameworkChoosing a Javascript Framework
Choosing a Javascript Framework
 
An Introduction to webOS
An Introduction to webOSAn Introduction to webOS
An Introduction to webOS
 
High Performance JavaScript (YUIConf 2010)
High Performance JavaScript (YUIConf 2010)High Performance JavaScript (YUIConf 2010)
High Performance JavaScript (YUIConf 2010)
 
Disrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applicationsDisrupting the application eco system with progressive web applications
Disrupting the application eco system with progressive web applications
 
Keeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and WebpackKeeping the frontend under control with Symfony and Webpack
Keeping the frontend under control with Symfony and Webpack
 
Getting Started with HTML 5 Web workers
Getting Started with HTML 5 Web workersGetting Started with HTML 5 Web workers
Getting Started with HTML 5 Web workers
 
JavaScript Web Workers
JavaScript Web WorkersJavaScript Web Workers
JavaScript Web Workers
 
Web workers
Web workersWeb workers
Web workers
 
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other ToolsCool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
Cool like a Frontend Developer: Grunt, RequireJS, Bower and other Tools
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015
 
Building Cross Platform Apps with Electron
Building Cross Platform Apps with ElectronBuilding Cross Platform Apps with Electron
Building Cross Platform Apps with Electron
 
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
How to Develop a Rich, Native-quality User Experience for Mobile Using Web St...
 
Responsive interfaces
Responsive interfacesResponsive interfaces
Responsive interfaces
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
High Performance JavaScript - Fronteers 2010
High Performance JavaScript - Fronteers 2010High Performance JavaScript - Fronteers 2010
High Performance JavaScript - Fronteers 2010
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
HTML5 vs Silverlight
HTML5 vs SilverlightHTML5 vs Silverlight
HTML5 vs Silverlight
 

Andere mochten auch (6)

Session 6.2 Cécile Barayre El Shami
Session 6.2 Cécile Barayre El ShamiSession 6.2 Cécile Barayre El Shami
Session 6.2 Cécile Barayre El Shami
 
How to Set-up and Maintain a Successful Open Data Initiative - Carlos Iglesias
How to Set-up and Maintain a Successful Open Data Initiative - Carlos IglesiasHow to Set-up and Maintain a Successful Open Data Initiative - Carlos Iglesias
How to Set-up and Maintain a Successful Open Data Initiative - Carlos Iglesias
 
CTO Cybersecurity Forum 2013 Koffi Fabrice Djossou
CTO Cybersecurity Forum 2013 Koffi Fabrice DjossouCTO Cybersecurity Forum 2013 Koffi Fabrice Djossou
CTO Cybersecurity Forum 2013 Koffi Fabrice Djossou
 
Special Consultation
Special ConsultationSpecial Consultation
Special Consultation
 
American deep state and 4th reich
American deep state and 4th reichAmerican deep state and 4th reich
American deep state and 4th reich
 
Love facts slide
Love facts slideLove facts slide
Love facts slide
 

Ähnlich wie APIs, now and in the future

Empowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsEmpowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsFITC
 
Empowering the Mobile Web - Mills
Empowering the Mobile Web - MillsEmpowering the Mobile Web - Mills
Empowering the Mobile Web - MillsCodemotion
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in schoolMichael Galpin
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5Roy Clarkson
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIsJames Pearce
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaChristian Heilmann
 
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...Sencha
 
Kuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsKuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsCameron Dutro
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.jsaortbals
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - MozillaRobert Nyman
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOSfpatton
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1Mohammad Qureshi
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGuillaume Laforge
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Todaydavyjones
 
Stupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management blissStupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management blissmacslide
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User ExperienceMahbubur Rahman
 

Ähnlich wie APIs, now and in the future (20)

Empowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris MillsEmpowering the “Mobile Web” with Chris Mills
Empowering the “Mobile Web” with Chris Mills
 
Empowering the Mobile Web - Mills
Empowering the Mobile Web - MillsEmpowering the Mobile Web - Mills
Empowering the Mobile Web - Mills
 
Android lessons you won't learn in school
Android lessons you won't learn in schoolAndroid lessons you won't learn in school
Android lessons you won't learn in school
 
HTML5 JS APIs
HTML5 JS APIsHTML5 JS APIs
HTML5 JS APIs
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Mobile Device APIs
Mobile Device APIsMobile Device APIs
Mobile Device APIs
 
Txjs
TxjsTxjs
Txjs
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
SenchaCon 2016: A Look Ahead: Survey Next-Gen Modern Browser APIs - Shikhir S...
 
Kuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails AppsKuby, ActiveDeployment for Rails Apps
Kuby, ActiveDeployment for Rails Apps
 
Riding the Edge with Ember.js
Riding the Edge with Ember.jsRiding the Edge with Ember.js
Riding the Edge with Ember.js
 
Web APIs & Apps - Mozilla
Web APIs & Apps - MozillaWeb APIs & Apps - Mozilla
Web APIs & Apps - Mozilla
 
Intro To webOS
Intro To webOSIntro To webOS
Intro To webOS
 
Intro to node and mongodb 1
Intro to node and mongodb   1Intro to node and mongodb   1
Intro to node and mongodb 1
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
 
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There TodayHTML5 is the Future of Mobile, PhoneGap Takes You There Today
HTML5 is the Future of Mobile, PhoneGap Takes You There Today
 
Stupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management blissStupid Boot Tricks: using ipxe and chef to get to boot management bliss
Stupid Boot Tricks: using ipxe and chef to get to boot management bliss
 
Node azure
Node azureNode azure
Node azure
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User Experience
 

Mehr von Chris Mills

More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable webChris Mills
 
Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Chris Mills
 
Guerrilla education
Guerrilla educationGuerrilla education
Guerrilla educationChris Mills
 
Documentation and publishing
Documentation and publishingDocumentation and publishing
Documentation and publishingChris Mills
 
Getting rid of images with CSS
Getting rid of images with CSSGetting rid of images with CSS
Getting rid of images with CSSChris Mills
 
Laying out the future
Laying out the futureLaying out the future
Laying out the futureChris Mills
 
Accessibility doesn't exist
Accessibility doesn't existAccessibility doesn't exist
Accessibility doesn't existChris Mills
 
Responsive web design standards?
Responsive web design standards?Responsive web design standards?
Responsive web design standards?Chris Mills
 
Adapt! Media queries and viewport
Adapt! Media queries and viewportAdapt! Media queries and viewport
Adapt! Media queries and viewportChris Mills
 
Adapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureAdapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureChris Mills
 
Angels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveAngels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveChris Mills
 
HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?Chris Mills
 
The W3C and the web design ecosystem
The W3C and the web design ecosystemThe W3C and the web design ecosystem
The W3C and the web design ecosystemChris Mills
 
HTML5 Pearson preso
HTML5 Pearson presoHTML5 Pearson preso
HTML5 Pearson presoChris Mills
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5Chris Mills
 
Inclusive design: real accessibility for everyone
Inclusive design: real accessibility for everyoneInclusive design: real accessibility for everyone
Inclusive design: real accessibility for everyoneChris Mills
 
The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)Chris Mills
 

Mehr von Chris Mills (20)

More efficient, usable web
More efficient, usable webMore efficient, usable web
More efficient, usable web
 
Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’Feedback handling, community wrangling, panhandlin’
Feedback handling, community wrangling, panhandlin’
 
Guerrilla education
Guerrilla educationGuerrilla education
Guerrilla education
 
BrazilJS MDN
BrazilJS MDNBrazilJS MDN
BrazilJS MDN
 
Documentation and publishing
Documentation and publishingDocumentation and publishing
Documentation and publishing
 
MDN is easy!
MDN is easy!MDN is easy!
MDN is easy!
 
Getting rid of images with CSS
Getting rid of images with CSSGetting rid of images with CSS
Getting rid of images with CSS
 
Future layouts
Future layoutsFuture layouts
Future layouts
 
Laying out the future
Laying out the futureLaying out the future
Laying out the future
 
Accessibility doesn't exist
Accessibility doesn't existAccessibility doesn't exist
Accessibility doesn't exist
 
Responsive web design standards?
Responsive web design standards?Responsive web design standards?
Responsive web design standards?
 
Adapt! Media queries and viewport
Adapt! Media queries and viewportAdapt! Media queries and viewport
Adapt! Media queries and viewport
 
Adapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the futureAdapt and respond: keeping responsive into the future
Adapt and respond: keeping responsive into the future
 
Angels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusiveAngels versus demons: balancing shiny and inclusive
Angels versus demons: balancing shiny and inclusive
 
HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?HTML5 and CSS3: does now really mean now?
HTML5 and CSS3: does now really mean now?
 
The W3C and the web design ecosystem
The W3C and the web design ecosystemThe W3C and the web design ecosystem
The W3C and the web design ecosystem
 
HTML5 Pearson preso
HTML5 Pearson presoHTML5 Pearson preso
HTML5 Pearson preso
 
Brave new world of HTML5
Brave new world of HTML5Brave new world of HTML5
Brave new world of HTML5
 
Inclusive design: real accessibility for everyone
Inclusive design: real accessibility for everyoneInclusive design: real accessibility for everyone
Inclusive design: real accessibility for everyone
 
The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)The web standards gentleman: a matter of (evolving) standards)
The web standards gentleman: a matter of (evolving) standards)
 

Kürzlich hochgeladen

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Kürzlich hochgeladen (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

APIs, now and in the future

  • 1. APIsNow, and in the future chris mills, mozillA
  • 2. Get the slides! •Don’t worry about notes •You can get the slides from slideshare.net/ chrisdavidmills •Sit back and relax •Or fidget if you get bored… •Ask questions at @chrisdavidmills or cmills@mozilla.com
  • 3. who am i? •I’m Chris •Mozilla, MDN writer •Twiddling around with JS/CSS/HTML •Firefox OS and APIs •Guerrilla education •Accessibility whiner •Heavy metal drummer
  • 4. APIslike, what are we talking about?
  • 5. •I really mean browser JavaScript APIs •Exposing complex functionality to JS •Making the Web more powerful and useful api, why oh why?
  • 6. •For a time, we only really had a few APIs •We had DOM stuff, and XHR •(And a bunch of horrid non-standard stuff) •But the scene exploded •WHATWG, Web Apps WG, and others api, why oh why?
  • 7. •Earlier APIs added interesting new features •E.g. Geolocation, Canvas •But this still wasn’t enough api, why oh why?
  • 8. •We want to remain competitive with native •Get everything working together more cohesively •Work offline ;-) •Deal with multimedia effectively in the browser •Improve performance, for games, etc. •Improve internationalization api, why oh why?
  • 9. •New ECMAScript 6 features shaping APIs •None more so than promises — async operations very important •(and maybe typed arrays) ES6 mention
  • 10. myFunction().then(function(value) { 
 return my2ndFunction(value);
 }).then(function(value) {
 // do something else with new value
 }).catch(function(err) {
 console.log(err);
 }); promise me this
  • 12. •Native platforms had better functionality •Hardware access •Offline •Access to core functionality •We wanted to catch up •And make it webby web versus native
  • 13. •We made this Firefox OS thing •To show what a web-based OS could be like •We invented a bunch of APIs •For fast iteration •To get to market on time •Browsers never had access
 to much of this before firefox os
  • 14. •Telephony/SMS/MMS •Bluetooth/NFC •Browser •FMRadio, TV •Camera, Contacts •Device storage, Data store •Settings, installation •etc, etc. proprietary apis
  • 15. •manifest.webapp file defines app •Including permissions for sensitive APIs •Web apps •Privileged •Certified (internal) installing apps
  • 16. manifest{ "version": "0.1", "name": "To-do alarms", "description": "My awesome open web app", "launch_path": "/index.html", "icons": { "128": "/img/icon-128.png" }, "developer": { "name": "Chris Mills", "url": "http://yourawesomeapp.com" }, "permissions": { "desktop-notification" : { "description": "Required to fire notifications" }, "alarms": { "description": "Required to schedule alarms" } }, "messages": [ { "alarm": "/index.html" }, { "notification": "/index.html" } ] }
  • 17. var install = navigator.mozApps.install(manifest_url); install.onsuccess = function(data) { // App is installed };
 install.onerror = function() { // App wasn't installed, info is in // install.error.name alert(install.error.name); }; Installing an app
  • 18. •Fortunately device API features are gradually starting to become standardized •We are implementing these things as they are available going standard
  • 19. •Geolocation •Device orientation •Notifications •Vibration •WebRTC/gUM for capturing media •Storage mechanisms (e.g. IndexedDB) •Battery Status some things work
  • 20. •WebNFC •Web Bluetooth •Service workers for offline (+ other stuff) •Manifest files •Permissions API •Web Speech API coming soon
  • 21. •The Web is a good thing •Progressive enhancement •No app stores •You can’t progressively enhance on native, or cache seamlessly, or render text easily we love web
  • 22. •Next version of Firefox OS to be more webby •Rather than trying to be native apps •Embracing the Web’s security model •Pin the Web •Save state •Packaged apps? new plan
  • 24. No connection = no experience
  • 25. •Especially on mobile •Offline data storage •Offline asset storage •Reacting to network changes offline is hard
  • 26. •Not so bad •We have storage mechanisms (e.g. IndexedDB, Web Storage, WebSQL) •Something available in most browsers •Plus polyfills (e.g. LocalForage) offline data
  • 27. •More of a pain •Firefox OS packaged apps installed and available offline •This doesn’t help the web at large •We had AppCache… offline assets
  • 29. •It’s actually fairly useless •Too much voodoo… •Assumed a specific set of behaviours but….
  • 31. •Proxy servers that sit between app and network •Intercepting network requests and customising responses •Does similar things to AppCache (plus a lot more…much harder to use) •Granular control over actions sw are cool
  • 32. if ('serviceWorker' in navigator) { navigator.serviceWorker.register('/sw-test/sw.js', { scope: '/*' }).then(function(sw) { // registration worked console.log('Registration succeeded.'); }).catch(function() { // registration failed console.log('Registration failed.'); }); } registration
  • 33. this.addEventListener('install', function(event) { event.waitUntil( caches.create('v1').then(function(cache) { return cache.add( '/sw-test/', '/sw-test/index.html', '/sw-test/style.css', '/sw-test/app.js', '/sw-test/image-list.js', '/sw-test/star-wars-logo.jpg' // etc. ); }) ); });
 installation
  • 34. this.addEventListener('fetch', function(event) { event.respondWith( caches.match(event.request).catch(function() { return caches.get('v1').then(function(cache) { cache.add(event.request); return event.default(); }); }).catch(function() { return caches.match('/sw-test/gallery/ myLittleVader.jpg'); }) ); });
 custom responses
  • 36. •Creating extra work, repetition, and confusion •E.g. CSS and SVG functionality overlap •Led to them forming the FXTF •More care taken these days •Extensible web manifesto — modular and explainable silos aren’t cool
  • 37. •Fetch is a good example •Similar to what XHR does •Abstracts the whole request/response model as JS objects •So it can be used with other APIs like Service Workers fetch / sw
  • 38. •Other specs also work well with/are based on SW: •Notifications API •Push API •Channel Messaging •They all contain partial additions for SW sw add-ons
  • 39. navigator.serviceWorker.ready.then(function(reg) { reg.pushManager.getSubscription()
 .then(function(subscription) { // Enable any UI for subscribing to push messages. var endpoint = subscription.endpoint; updateStatus(endpoint,'init'); }).catch(function(err) { console.log('Error during getSubscription()', err); }); });
 push
  • 40. self.addEventListener('push', function(event) { 
 event.waitUntil( self.registration.showNotification(title, { body: body, icon: icon, tag: tag }) );
 });
 notifications
  • 41. var channel = new MessageChannel(); channel.port1.onmessage = function(e) { alert(e.data); } mySW = reg.active; mySW.postMessage('hello', [channel.port2]);
 channel msg self.onmessage = function(e) { port = e.ports[0]; }
 
 port.postMessage(‘hello');

  • 44. •Media was broken for years on the Web •Audio/video delivery needed Flash for so long •The <video> tag took long enough fix media
  • 45. •We already mentioned WebRTC/gUM •Should solve many use cases, from simple image and video capture to video conferencing •What about recording? •Media Recorder API media capture
  • 46. var constraints = { audio: true, video: true }; var onSuccess = function(stream) { // do stuff with your media stream }; var onError = function(err) { console.log('The following error occurred: ' + err); } navigator.getUserMedia(constraints, onSuccess, onError); getusermedia
  • 47. var mediaRecorder = new MediaRecorder(stream); record.onclick = function() { mediaRecorder.start(); } stop.onclick = function() { mediaRecorder.stop(); } mediaRecorder.ondataavailable = function(e) { var audio = document.createElement('audio'); audio.setAttribute('controls', ''); var audioURL = window.URL.createObjectURL(e.data); audio.src = audioURL; } media recorder
  • 48. •Media Source Extensions •Encrypted Media Extensions •DRM on the Web?!? •A necessary evil, WRT services like Netflix..? •Netflix involved in both the above specs streaming/drm
  • 49. •Web Audio API •Precise audio control •Add effects •Split and merge audio channels •Spatialization •Audio visualizations •WebMIDI coming too… audio processing
  • 51. •General performance much improved •Web Workers •Emscripten/asm.js •WebGL •SIMD •WebVR (mozvr.com also good) performance
  • 52.
  • 54. •The Web is international •But adapting sites for an intl. audience is a pain •E.g. Dealing with time/date formats •And BIDI websites •But we are working on this too i18n
  • 55. var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); console.log(new Intl.DateTimeFormat().format(date));
 console.log(new Intl.DateTimeFormat('en- US').format(date));
 
 // DateTimeFormat without arguments returns the
 // correct value for the language/timezone. JavaScript i18n api •The JS Internationalization API provides features for formatting dates/times for different languages, etc.
  • 56. #content { padding-left: 12px: margin-right: 20px; }
 html[dir="rtl"] #content { padding-left: 0; padding-right: 12px; margin-left: 20px; margin-right: 0; } CSS BIDI features •BIDI websites are simpler to layout with CSS BIDI features
  • 58. FinitoThanks for listening! chris mills, mozillA@chrisdavidmills, cmills@mozilla.com
  • 59. •Main image: Bokeh Dandelion, by Nicolas Raymond credits