12 Matching Annotations
  1. Jan 2022
  2. www.npmjs.com www.npmjs.com
    1. co(function* () {  var result = yield Promise.resolve(true);  return result;}).then(function (value) {  console.log(value);}, function (err) {  console.error(err.stack);});
  3. Nov 2021
  4. Jan 2021
    1. While custom iterators are a useful tool, their creation requires careful programming due to the need to explicitly maintain their internal state. Generator functions provide a powerful alternative: they allow you to define an iterative algorithm by writing a single function whose execution is not continuous. Generator functions are written using the function* syntax.
  5. Oct 2020
  6. Sep 2020
    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. Note that to use the this context the test function must be a function expression (function test(value) {}), not an arrow function, since arrow functions have lexical context.
  7. Jul 2020
    1. name provided to a function expression as above is only available to the function's own scope
    2. supports functional programming — because they are objects, functions may be stored in variables and passed around like any other object