W3C
W3C
蒂姆伯李
“One web under heaven” — Timblucius @frivoal
参与: CSS Working Group, drafts, blog, GH
var observer = new PerformanceObserver(function(list) {
for (var i = 0; i < perfEntries.length; i++)
{
...
}
if (doneObservingEvents) {
observer.disconnect();
}
});
// subscribe to Resource-Timing and User-Timing events
observer.observe({entryTypes: ['resource', 'mark', 'measure']});
示例:
Server Timing: 允许 Server 和 浏览器沟通 request-response 循环里的性能数据
GET /resource HTTP/1.1
> Host: example.com
< HTTP/1.1 200 OK
< Server-Timing: miss, db;dur=53, app;dur=47.2
< Server-Timing: customView, dc;desc=atl
< Server-Timing: cache;desc="Cache Read";dur=23.2
[Exposed=(Window,Worker)]
interface PerformanceServerTiming {
readonly attribute DOMString name;
readonly attribute DOMHighResTimeStamp duration;
readonly attribute DOMString description;
[Default] object toJSON();
};
示例:
performance.getEntriesByType(“resource”)
performance.getEntriesByType(“navigation”)
observer.observe({entryTypes: ["paint"]});
observer.observe({entryTypes: ["longtask"]});
performance.mark("task")
performance.getEntriesByType(“mark”)
performance.measure(“name”, “task1”, "task2" )
performance.getEntriesByType(“measure”)
navigator.connection.effectiveType
navigator.connection.type
Accept-CH = Device-Memory
Device-Memory: 0.5
navigator.deviceMemory
<link rel="preload" href=“/url" as=“type”>
当前页 as=audio, video, style, script, document(for iframe), image…
高优先级的 fetch,预加载资源,但不执行,as 必须定义;
参与: PWAs and Beyond: The Next Generation of Web Apps (Sakura)
它们能否协作?
探索需求和语言定义 WebAssembly Community Group
测试与社区 review WebAssembly Working Group
安全地存储账户信息,实现流畅支付
跨平台地实现用户个性化支付
减少商户冗余代码,一个API替代各种插件
Chrome,Safari,Edge,三星已实现,Firefox 8月支持
Facebook, Shopify, Stripe, Braintree, WePay, Bluesnap, Paysafe, BS Payone等已使用
通过浏览器电子钱包实现支付
以浏览器协调电商、银行、用户的关系,提供安全便捷的接口支持
通过浏览器UI简化用户交互
Safari 和 Chrome 已经支持app handler
Chrome 已经支持浏览器 handler,三星和FF开发中
Coil, Facebook, Klarna, Lyra Networks, Mastercard, Shopify, Worldline,和 Worldpay等公司在试验中
const methodData = [{
supportedMethods: "basic-card",
data: {
supportedNetworks: ["visa", "mastercard"],
supportedTypes: ["debit", "credit"],
},
}, {
supportedMethods: "https://example.com/bobpay",
data: {
merchantIdentifier: "XXXX",
bobPaySpecificField: true,
},
}];
const details = {
id: "super-store-order-123-12312",
displayItems: [{
label: "Sub-total",
amount: { currency: "USD", value: "55.00" },
}, {
label: "Sales Tax",
amount: { currency: "USD", value: "5.00" },
type: "tax"
}],
total: {
label: "Total due",
amount: { currency: "USD", value: "65.00" },
}};
async function doPaymentRequest() {
try {
const request = new PaymentRequest(methodData, details, options);
request.onshippingoptionchange = ev => ev.updateWith(details);
const response = await request.show();
await validateResponse(response);
} catch (err) {}
}
async function validateResponse(response) {
try {
if (await checkAllValuesAreGood(response)) {
await response.complete("success");
} else {
await response.complete("fail");
}
} catch (err) {}
}
doPaymentRequest();
Participate: Working Group, Commerce IG
<span id="button" role="button" tabindex="0">Tequila!</span>
<button role="heading" aria-level="1">Tequila!</button>
<span id="button" role="button" tabindex="0">Tequila!</span>
xiaoqian@w3.org / @siusinng小倩
资料: W3C, WICG, MDN, Léonie Watson