Skip to content

Commit

Permalink
site: document additional arguments in svelte.walk
Browse files Browse the repository at this point in the history
  • Loading branch information
Conduitry committed May 20, 2019
1 parent 7ebf347 commit 1e91911
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions site/content/docs/04-compile-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,8 @@ const { code } = svelte.preprocess(source, [

```js
walk(ast: Node, {
enter(node: Node, parent: Node)?: void,
leave(node: Node, parent: Node)?: void
enter(node: Node, parent: Node, prop: string, index: number)?: void,
leave(node: Node, parent: Node, prop: string, index: number)?: void
})
```

Expand All @@ -323,13 +323,13 @@ The walker takes an abstract syntax tree to walk and an object with two optional
```js
const svelte = require('svelte/compiler');
svelte.walk(ast, {
enter(node, parent) {
enter(node, parent, prop, index) {
do_something(node);
if (should_skip_children(node)) {
this.skip();
}
},
leave(node, parent) {
leave(node, parent, prop, index) {
do_something_else(node);
}
});
Expand Down

0 comments on commit 1e91911

Please sign in to comment.