Web API 100


使便API
(Google)
pastak


"WebAPI"

Ecma InternationalECMA-262
Living Standard1
: https://tc39.es/ecma262/
ArrayNumberES modulesasync-awaitclassglobalThisJS

HTML/DOM/CSS
whatwgLiving Standard
JavaScriptFetchStorageWebRTC
FetchAbortPromiseAbortAbortFetch
DOMPromiseES

Web Incubator Community Group
W3C1
WebAPI
Chrome使API
2020/8/17140
Gyazo

WebHTMLJavaScript
V8ESnode使
commonjsrequireESStreamswhatwgnode

Web

ES modules
async-await
Fetch / ServiceWorker
LocalStorage / IndexedDB
WebRTC
...etc

Apple
AppStore
ServiceWorker / PWA
ES
APISafari()

Chrome (/w MSEdge) Web
WICGChromiumChromiumOrigin Trial
WebChromiumPortals
APIChrome

(Google)

ServiceWorkerPWAWeb

AMP / ServiceWorker / prefetch / WebBundle

WASM / WebTransport / WebGL(Canvas)
WebUSB / Web NFC / Web Bluetooth
AppleMozillaChrome

:
AppleMozilla/
Safari: ITP / Storage7
Firefox: ETP (ITPFxUA)
Google
Cookie
GDPR
3rd Party Cookie
Safari3rd Party Cookie
SameSite Cookie
Storage Access API
ChromiumEdgeChromium https://bugs.chromium.org/p/chromium/issues/detail?id=989663#c17
chrome://flags/#storage-access-api
3rd Partry Cookie

Nota使API
CSS
WICG1()

API

Async Clipboard
Streams API
Virtual Keyboard
API
content-visibility

Promise 使API
navigator.clipboard.readText()
navigator.clipboard.read()
navigator.clipboard.writeText()
navigator.clipboard.write()
image/png text/plain
image/jpg issue

Streams API chromefirefoxsafari
ReadableStream / WritableStream / TransformStream
ReadableStream
: Fetch Response.body ReadableStream
ReadableStream
FetchReadableStreamReadableStream
const startFetch = caches.match('/shell-start.cbd594dfa81d.inc');
const endFetch = caches.match('/shell-end.cbd594dfa81d.inc');
const middleFetch = fetch(url).then(response => {
if (!response.ok && response.status != 404) {
return caches.match('/error.ba6821d4f751.inc');
}
return response;
}).catch(err => caches.match('/offline.d989ddb2d13b.inc'));
function pushStream(stream) {
const reader = stream.getReader();
return reader.read().then(function process(result) {
if (result.done) return;
controller.enqueue(result.value);
return reader.read().then(process);
});
}
startFetch
.then(response => pushStream(response.body))
.then(() => middleFetch)
.then(response => pushStream(response.body))
.then(() => endFetch)
.then(response => pushStream(response.body))
.then(() => controller.close());
}
ReadableStream
new ReadableStream
const stream = new ReadableStream({
start(controller) {
interval = setInterval(() => {
let string = randomChars();
controller.enqueue(string);
if (Math.random > 0.95) controller.close()
}, 100);
},
cancel() {
clearInterval(interval);
}
});
WebRTC
MediaStream
HTMLCanvasElement.captureStream
MediaRecorder
TextEncoder Uint8Array
Worker使(Chrome flag: enable-experimental-web-platform-features)
Streams postMessage
Gyazo
Worker
ChromeFetch Request.body ReadableStream使(Chrome 85b /w flag: enable-experimental-web-platform-features)
websocket使
HTTP使Proxy

Virtual Keyboard
SurfaceMSEdgeVirtual KeyboardAPI
iOS
Gyazo
window.navigator.virtualKeyboard.overlaysContent = true;
navigator.virtualKeyboard.addEventListener("geometrychange", (evt) => {
let { width, height } = evt.boundingRect;
if( width !== 0 && height !== 0 ) {
console.log('virtual keyboard is now visible!')
}
document.querySelector(".search-box").style.bottom = `${height + 15}px`;
});
.search-box {
position: absolute;
bottom: env(keyboard-inset-bottom);
}
css media-query prefers-color-schema

API chromefirefoxsafari
TouchEvent.touches: Touch[]
touch.touchType :
direct , stylus
Touch.azimuthAngle / Touch.altitudeAngle :
Gyazo
Touch.force : (0 - 1) float
PointerEvent.touchType === 'pen' :
touch , mouse
PointerEvent.pressure : (0 - 1) float
PointerEvent.twist : (0 - 359)
Surface Pro penApple PencilAPI
penbuttonclick , penbuttondblclick
penbuttonpressandhold :
pendockchange : dock

Chrome 85
CSS ContainmentCSS Containment Module Level 21
Gyazo
content-visibility: auto chunk
loading="auto"content-visibility
Gyazo
contain layout , style , paint size
contain-intrinsic-size placeholder
content-visibility: hidden 使rendering state
display: none : rendering state
visibility: hidden : rendering stateblock
content-visibility: hidden-matchable
Scroll To Text Fragment
beforematch
Chrome 85flag

60使API
使
使
Chrome
UAfeature detection
Slack#frontend

"Web API"Google Maps APIJavaScriptAPI
MDNWeb APIsJavaScriptCSSAPI