21 Matching Annotations
  1. Jul 2021
    1. “!e ‘projecting’ of‘futurologists’ uses the future as the safest possible context forwhatever is desired; it binds one only to selfish interest. But makinga promise binds one to someone else’s future.”

      This is part of why Mark Zuckerberg's promises to "do better in the future" are wholly unbelievable and disingenuous.

  2. Feb 2021
    1. An async function simply implies that a promise will be returned and if a promise is not returned, JavaScript will automatically wrap it in a resolved promise with the return value in that function. That would look like writing return Promise.resolve(‘hello’)
  3. Oct 2020
    1. Returns a Promise<?Object> that resolves with no value on success or resolves with an Object of submission errors on failure. The reason it resolves with errors is to leave rejection for when there is a server or communications error.
    1. Another example:

      const expensiveOperation = async (value) => {
        // return Promise.resolve(value)
          // console.log('value:', value)
          await sleep(1000)
          console.log('expensiveOperation: value:', value, 'finished')
          return value
      }
      
      var expensiveOperationDebounce = debounce(expensiveOperation, 100);
      
      // for (let num of [1, 2]) {
      //   expensiveOperationDebounce(num).then(value => {
      //     console.log(value)
      //   })
      // }
      (async () => { await sleep(0   ); console.log(await expensiveOperationDebounce(1)) })();
      (async () => { await sleep(200 ); console.log(await expensiveOperationDebounce(2)) })();
      (async () => { await sleep(1300); console.log(await expensiveOperationDebounce(3)) })();
      // setTimeout(async () => {
      //   console.log(await expensiveOperationDebounce(3))
      // }, 1300)
      

      Outputs: 1, 2, 3

      Why, if I change it to:

      (async () => { await sleep(0   ); console.log(await expensiveOperationDebounce(1)) })();
      (async () => { await sleep(200 ); console.log(await expensiveOperationDebounce(2)) })();
      (async () => { await sleep(1100); console.log(await expensiveOperationDebounce(3)) })();
      

      Does it only output 2, 3?

  4. Sep 2020
    1. Your problem is that you were returning the rejected loginDaoCall, not the promise where the error was already handled. loginApi.login(user, password) did indeed return a rejected promise, and even while that was handled in another branch, the promise returned by the further .then() does also get rejected and was not handled.
    2. // LoginApi.js return loginDao.login(username, password).then(function (res) { store.dispatch(loginSuccess()); log.log("[loginApi.login] END"); return true; }, function (err) { store.dispatch(loginFail()); errorUtils.dispatchErrorWithTimeout(errorLogin); log.log(err); return false; }); // never supposed to reject
    1. This treatment of thenables allows promise implementations to interoperate, as long as they expose a Promises/A+-compliant then method. It also allows Promises/A+ implementations to “assimilate” nonconformant implementations with reasonable then methods.
    2. the promise specification explicitly does not make a distinction
    1. This isn't really a bug, because if you have an async function that returns a function, it doesn't really return a function - it returns a promise. I don't remember whether the Svelte internals currently check for the onMount callback's return being a function or whether they check for it being truthy. Maybe there's some adjustment to be made there.
    1. Here we store the three Promise objects in variables, which has the effect of setting off their associated processes all running simultaneously. Next, we await their results — because the promises all started processing at essentially the same time, the promises will all fulfill at the same time
  5. May 2020
  6. developer.mozilla.org developer.mozilla.org
    1. The promises of a chain are nested like Russian dolls, but get popped like the top of a stack.
    2. Similarly, .catch() is really just a .then() without a slot for handleFulfilled.
    3. in the absence of an immediate need, it is simpler to leave out error handling until a final .catch() statement.
    4. Handling a rejected promise too early has consequences further down the promise chain.   Sometimes there is no choice, because an error must be handled immediately.
  7. Mar 2020
    1. The remedy which the tradition of Western thought has proposed for the unpredictability and irreversibility of action has consisted in abstaining from action altogether, in the withdrawal from the sphere of interaction with others, in the hope that one’s freedom and integrity could thereby be preserved. Platonism, Stoicism and Christianity elevated the sphere of contemplation above the sphere of action, precisely because in the former one could be free from the entanglements and frustrations of action. Arendt’s proposal, by contrast, is not to turn one’s back on the realm of human affairs, but to rely on two faculties inherent in action itself, the faculty of forgiving and the faculty of promising. These two faculties are closely connected, the former mitigating the irreversibility of action by absolving the actor from the unintended consequences of his or her deeds, the latter moderating the uncertainty of its outcome by binding actors to certain courses of action and thereby setting some limit to the unpredictability of the future. Both faculties are, in this respect, connected to temporality: from the standpoint of the present forgiving looks backward to what has happened and absolves the actor from what was unintentionally done, while promising looks forward as it seeks to establish islands of security in an otherwise uncertain and unpredictable future.