Skip to content

Commit 69ea56b

Browse files
authored
Merge pull request #627 from highcharts/563/async-example-readme
563/async-example-readme
2 parents fd5edc3 + 2c7f499 commit 69ea56b

5 files changed

Lines changed: 24 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ _Fixes:_
1111
- Fixed an issue where the chart constructor was sometimes incorrectly set, causing the export to fail
1212
- Added referrers to CDN cache fetches on first startup/install.
1313
- Fixed an issue that would sometimes cause cause a crash due to fail due to `Accept-Ranges` headers
14+
- Corrected the `Node.js Module` example in the README.
1415
- Fixed the warning message when the the default `resources.json` file is not found.
1516
- Fixed the problem with the lack of the `instr` value, when the `options` is set instead
1617

1718
_New Features:_
1819

1920
- Added proxy authentication [(#631)](https://github.com/highcharts/node-export-server/issues/631).
20-
21-
_New features:_
22-
2321
- Made the temporary Puppeteer directory (`PUPPETEER_TEMP_DIR`) (till now, `'./tmp'`) configurable by the user [(#567)](https://github.com/highcharts/node-export-server/issues/567).
2422

23+
2524
# 4.0.2
2625

2726
_Hotfix_:

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -584,20 +584,23 @@ const options = {
584584
}
585585
};
586586
587-
// Initialize export settings with your chart's config
588-
const exportSettings = exporter.setOptions(options);
589-
590-
// Must initialize exporting before being able to export charts
591-
await exporter.initExport(exportSettings);
592-
593-
// Perform an export
594-
await exporter.startExport(exportSettings, async (error, info) => {
595-
// The export result is now in info
596-
// It will be base64 encoded (info.data)
597-
598-
// Kill the pool when we are done with it
599-
await exporter.killPool();
600-
});
587+
// Logic must be triggered in an asynchronous function
588+
(async () => {
589+
// Initialize export settings with your chart's config
590+
const exportSettings = exporter.setOptions(options);
591+
592+
// Must initialize exporting before being able to export charts
593+
await exporter.initExport(exportSettings);
594+
595+
// Perform an export
596+
await exporter.startExport(exportSettings, async (error, info) => {
597+
// The export result is now in info
598+
// It will be base64 encoded (info.result)
599+
600+
// Kill the pool when we are done with it
601+
await exporter.killPool();
602+
});
603+
})();
601604
```
602605

603606
## CommonJS support

dist/index.cjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/index.esm.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.esm.js.map

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)