Skip to content

Explainer videos and product demos made by your AI agent. Free and open source: a local voice (Kokoro), word timing (Whisper) and a canvas renderer turn a script into a narrated MP4.

942 B
Raw Blame
// getUser and getOrders are application helpers, not the native fetch API.
// The callback version shows the success path. The promise versions add errors.
export const callback = `getUser(7, user => {
  getOrders(user.id, orders => {
    showOrders(orders);
  });
});`;

export const promise = `getUser(7)
  .then(user => {
    return getOrders(user.id);
  })
  .then(orders => showOrders(orders));`;

export const promiseErrors = `getUser(7)
  .then(user => {
    return getOrders(user.id);
  })
  .then(orders => showOrders(orders))
  .catch(err => showError(err));`;

export const awaited = `async function loadOrders() {
  const user = await getUser(7);
  const orders = await getOrders(user.id);
  showOrders(orders);
}`;

export const awaitedErrors = `async function loadOrders() {
  try {
    const user = await getUser(7);
    const orders = await getOrders(user.id);
    showOrders(orders);
  } catch (err) { showError(err); }
}`;