Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update event docs #185

Merged
merged 4 commits into from
Jul 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions src/i18n/en/docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ runBundle();

This is a list of all bundler events

* `bundled` gets called once Parcel has successfully finished bundling **for the first time**, the main [bundle](#bundle) gets passed to the callback
* `bundled` gets called once Parcel has successfully finished bundling **for the first time**, the main [bundle](#bundle) instance gets passed to the callback
```Javascript
const bundler = new Bundler(...);
bundler.on('bundled', (bundler) => {
bundler.on('bundled', (bundle) => {
// bundler contains all assets and bundles, see documentation for details
});
// call bundler.bundle() somewhere
// Call this to start bundling
bundler.bundle();
```

* `buildEnd` gets called after each build (aka **including every rebuild**), this also emits if an error occurred
Expand All @@ -60,7 +61,28 @@ const bundler = new Bundler(...);
bundler.on('buildEnd', () => {
// Do something...
});
// call bundler.bundle() somewhere
// Call this to start bundling
bundler.bundle();
```

* `buildStart` gets called at the start of the first build, the `entryFiles` Array gets passed to the callback
```Javascript
const bundler = new Bundler(...);
bundler.on('buildError', entryPoints => {
// Do something...
});
// Call this to start bundling
bundler.bundle();
```

* `buildError` gets called every time an error occurs during builds, the `Error` Object gets passed to the callback
```Javascript
const bundler = new Bundler(...);
bundler.on('buildError', error => {
// Do something...
});
// Call this to start bundling
bundler.bundle();
```

### Bundle
Expand Down