|
281 | 281 | - date: June 2019
|
282 | 282 | url: https://github.com/tc39/notes/blob/master/meetings/2019-06/june-6.md#weakrefs
|
283 | 283 |
|
284 |
| -- title: Nullish Coalescing for JavaScript |
285 |
| - id: proposal-nullish-coalescing |
286 |
| - has_specification: true |
287 |
| - description: When performing property accesses, it is often desired to provide a default value if the result of that property access is null or undefined. At present, a typical way to express this intent in JavaScript is by using the `||` operator. This introduces a `??` operator. |
288 |
| - authors: |
289 |
| - - Gabriel Isenberg |
290 |
| - - Daniel Ehrenberg |
291 |
| - - Daniel Rosenwasser |
292 |
| - champions: |
293 |
| - - Gabriel Isenberg |
294 |
| - - Daniel Rosenwasser |
295 |
| - - Justin Ridgewell |
296 |
| - example: > |
297 |
| - const response = { |
298 |
| -
|
299 |
| - settings: { |
300 |
| -
|
301 |
| - nullValue: null, |
302 |
| -
|
303 |
| - height: 400, |
304 |
| -
|
305 |
| - animationDuration: 0, |
306 |
| -
|
307 |
| - headerText: '', |
308 |
| -
|
309 |
| - showSplashScreen: false |
310 |
| -
|
311 |
| - } |
312 |
| -
|
313 |
| - }; |
314 |
| -
|
315 |
| - const undefinedValue = response.settings.undefinedValue || 'some other default'; // result: 'some other default' |
316 |
| -
|
317 |
| - const nullValue = response.settings.nullValue || 'some other default'; // result: 'some other default' |
318 |
| -
|
319 |
| - presented: |
320 |
| - - date: July 2019 |
321 |
| - |
322 |
| -- title: RegExp Match array offsets |
| 284 | +- title: RegExp Match Indices |
323 | 285 | id: proposal-regexp-match-indices
|
324 | 286 | has_specification: true
|
325 | 287 | description: ECMAScript RegExp Match Indicies provide additional information about the start and end indices of captured substrings relative to the start of the input string.
|
|
368 | 330 | presented:
|
369 | 331 | - date: July 2019
|
370 | 332 |
|
371 |
| -- title: Optional Chaining |
372 |
| - id: proposal-optional-chaining |
| 333 | +- title: Promise.any |
| 334 | + id: proposal-promise-any |
373 | 335 | has_specification: true
|
374 |
| - description: The Optional Chaining Operator allows a developer to handle cases where if a property on an object is optional, they are able to check before accessing it. |
| 336 | + description: Promise.any accepts an iterable of promises and returns a promise that is fulfilled by the first given promise to be fulfilled, or rejected with an AggregateError holding the rejection reasons if all of the given promises are rejected. . |
375 | 337 | authors:
|
376 |
| - - Claude Pache |
377 |
| - - Gabriel Isenberg |
378 |
| - - Dustin Savery |
| 338 | + - Mathias Bynens |
| 339 | + - Kevin Gibbons |
| 340 | + - Sergey Rubanov |
379 | 341 | champions:
|
380 |
| - - Gabriel Isenberg |
381 |
| - - Dustin Savery |
382 |
| - - Justin Ridgewell |
383 |
| - - Daniel Rosenwasser |
| 342 | + - Mathias Bynens |
384 | 343 | example: >
|
385 |
| - // Before |
| 344 | + try { |
386 | 345 |
|
387 |
| - var fooInput = myForm.querySelector('input[name=foo]') |
| 346 | + const first = await Promise.any(promises); |
388 | 347 |
|
389 |
| - var fooValue = fooInput ? fooInput.value : undefined |
| 348 | + // Any of the promises was fulfilled. |
390 | 349 |
|
391 |
| - // After, with optional chaining |
| 350 | + } catch (error) { |
392 | 351 |
|
393 |
| - var street = user.address?.street |
| 352 | + // All of the promises were rejected. |
394 | 353 |
|
395 |
| - var fooValue = myForm.querySelector('input[name=foo]')?.value |
| 354 | + } |
396 | 355 |
|
397 | 356 | presented:
|
398 |
| - - date: July 2019 |
| 357 | + - date: June 2020 |
| 358 | + url: https://github.com/tc39/notes/blob/master/meetings/2020-06/june-2.md#aggregateerror-constructor-update |
399 | 359 |
|
400 |
| -- title: for-in mechanics |
401 |
| - id: proposal-for-in-order |
402 |
| - has_specification: true |
403 |
| - description: Partially specifying object enumeration order in JavaScript |
404 |
| - authors: |
405 |
| - - Kevin Gibbons |
406 |
| - champions: |
407 |
| - - Kevin Gibbons |
408 |
| - presented: |
409 |
| - - date: October 2019 |
410 |
| - url: https://github.com/tc39/notes/blob/master/meetings/2019-10/october-1.md#for-in-order-for-stage-3 |
411 |
| - |
412 |
| - |
413 |
| -- title: String.prototype.replaceAll |
414 |
| - id: proposal-string-replaceall |
415 |
| - has_specification: true |
416 |
| - description: Introduce String.prototype.replaceAll as a way to replace all in a string |
417 |
| - authors: |
418 |
| - - Peter Marshall |
419 |
| - - Jakob Gruber |
420 |
| - - Mathias Bynens |
421 |
| - champions: |
422 |
| - - Mathias Bynens |
423 |
| - example: > |
424 |
| - const queryString = 'q=query+string+parameters'; |
425 |
| - const withSpaces = queryString.replaceAll('+', ' '); |
426 |
| - presented: |
427 |
| - - date: October 2019 |
428 |
| - url: https://github.com/tc39/notes/blob/master/meetings/2019-10/october-2.md#stringprototypereplaceall-for-stage-3 |
429 | 360 |
|
430 | 361 | - title: Atomics.waitAsync
|
431 | 362 | id: proposal-atomics-wait-async
|
432 | 363 | has_specification: true
|
433 | 364 | description: A proposal for an "asynchronous atomic wait" for ECMAScript, primarily for use in agents that are not allowed to block.
|
434 | 365 | authors:
|
435 |
| - - Shu-yu Guo |
436 |
| - - Lars T. Hansen |
| 366 | + - Lars Hansen |
437 | 367 | champions:
|
438 |
| - - Shu-yu Guo |
439 |
| - - Lars T. Hansen |
| 368 | + - Shu-Yu Guo |
| 369 | + - Lars Hansen |
440 | 370 | example: >
|
441 |
| - var sab = new SharedArrayBuffer(4096); |
442 |
| - var ia = new Int32Array(sab); |
443 |
| - ia[37] = 0x1337; |
444 |
| - test1(); |
445 |
| - function test1() { |
446 |
| - Atomics.waitAsync(ia, 37, 0x1337, 1000).then(function (r) { log(`Resolved ${r}`); test2(); } ); |
| 371 | + var sab = new SharedArrayBuffer(4096); |
| 372 | +
|
| 373 | + var ia = new Int32Array(sab); |
| 374 | +
|
| 375 | + ia[37] = 0x1337; |
| 376 | +
|
| 377 | + test1(); |
| 378 | +
|
| 379 | +
|
| 380 | + function test1() { |
| 381 | +
|
| 382 | + Atomics.waitAsync(ia, 37, 0x1337, 1000).then(function (r) { log("Resolved: " + r); test2(); }); |
| 383 | +
|
| 384 | + } |
| 385 | +
|
| 386 | +
|
| 387 | + var code = ` |
| 388 | +
|
| 389 | + var ia = null; |
| 390 | +
|
| 391 | + onmessage = function (ev) { |
| 392 | +
|
| 393 | + if (!ia) { |
| 394 | +
|
| 395 | + postMessage("Aux worker is running"); |
| 396 | +
|
| 397 | + ia = new Int32Array(ev.data); |
| 398 | +
|
447 | 399 | }
|
| 400 | +
|
| 401 | + postMessage("Aux worker is sleeping for a little bit"); |
| 402 | +
|
| 403 | + setTimeout(function () { postMessage("Aux worker is waking"); Atomics.notify(ia, 37); }, 1000); |
| 404 | +
|
| 405 | + }`; |
| 406 | +
|
| 407 | +
|
| 408 | + function test2() { |
| 409 | +
|
| 410 | + var w = new Worker("data:application/javascript," + encodeURIComponent(code)); |
| 411 | +
|
| 412 | + w.onmessage = function (ev) { log(ev.data) }; |
| 413 | +
|
| 414 | + w.postMessage(sab); |
| 415 | +
|
| 416 | + Atomics.waitAsync(ia, 37, 0x1337).then(function (r) { log("Resolved: " + r); test3(w); }); |
| 417 | +
|
| 418 | + } |
| 419 | +
|
| 420 | +
|
| 421 | + function test3(w) { |
| 422 | +
|
| 423 | + w.postMessage(false); |
| 424 | +
|
| 425 | + Atomics.waitAsync(ia, 37, 0x1337).then(function (r) { log("Resolved 1: " + r); }); |
| 426 | +
|
| 427 | + Atomics.waitAsync(ia, 37, 0x1337).then(function (r) { log("Resolved 2: " + r); }); |
| 428 | +
|
| 429 | + Atomics.waitAsync(ia, 37, 0x1337).then(function (r) { log("Resolved 3: " + r); }); |
| 430 | +
|
| 431 | + } |
| 432 | +
|
| 433 | +
|
| 434 | + function log(msg) { |
| 435 | +
|
| 436 | + document.getElementById("scrool").innerHTML += String(msg) + "\n"; |
| 437 | +
|
| 438 | + } |
| 439 | +
|
| 440 | +
|
448 | 441 | presented:
|
449 | 442 | - date: December 2019
|
450 | 443 | url: https://github.com/tc39/notes/blob/master/meetings/2019-12/december-4.md#atomicswaitasync-for-stage-3
|
|
0 commit comments