Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Aug 30, 2022
1 parent 3862c84 commit c7081b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
9 changes: 0 additions & 9 deletions packages/kit/src/exports/hooks/sequence.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
/**
* Merge an array of multiple handlers into one. The `resolve` passed
* to the first handler will call the second handler, and so on,
* until the last handler calls the framework.
*
* If handlers use the `transformPageChunk` option, the functions
* will be 'chained', meaning a transform function specified in
* the first handler will be applied to later handlers, and
* multiple transformations can be applied.
*
* @param {...import('types').Handle} handlers
* @returns {import('types').Handle}
*/
Expand Down
17 changes: 15 additions & 2 deletions packages/kit/types/ambient.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,26 @@ declare module '@sveltejs/kit/hooks' {
* /** @type {import('@sveltejs/kit').Handle} *\/
* async function first({ event, resolve }) {
* console.log('first pre-processing');
* const result = await resolve(event);
* const result = await resolve(event, {
* transformPageChunk: ({ html }) => {
* // transforms are applied in reverse order
* console.log('first transform');
* return html;
* }
* });
* console.log('first post-processing');
* return result;
* }
*
* /** @type {import('@sveltejs/kit').Handle} *\/
* async function second({ event, resolve }) {
* console.log('second pre-processing');
* const result = await resolve(event);
* const result = await resolve(event, {
* transformPageChunk: ({ html }) => {
* console.log('second transform');
* return html;
* }
* });
* console.log('second post-processing');
* return result;
* }
Expand All @@ -321,6 +332,8 @@ declare module '@sveltejs/kit/hooks' {
* ```
* first pre-processing
* second pre-processing
* second transform
* first transform
* second post-processing
* first post-processing
* ```
Expand Down

0 comments on commit c7081b7

Please sign in to comment.