Skip to content

v0.54.0

Pre-release
Pre-release

Choose a tag to compare

@yhdgms1 yhdgms1 released this 02 Jul 11:29
· 5 commits to main since this release
03b8493

Custom Actions Request

There is a way to override function used to fetch data in novely config.

const engine = novely({
  ...config,
  fetch: async (...args) => {
    console.log(args)
    return await window.fetch(...args);
  }
})

That function now is passed to custom actions.

const handler: CustomHandler = async ({ request }) => {
  await request('something.json')
};

Custom Actions Assets

Custom actions have .assets field, previously it could be only an array, but now it can also be a function.

const handler: CustomHandler = async () => {};

// handler.assets = [url];
handler.assets = async ({ request }) => {
  return await request('assets-for-my-action.json').then((r) => r.json())
}

When duration of assets function exceeds 250 ms empty array will be used instead of awaiting more. Function will be overwritten, always returning value from first run.