diff --git a/CHANGELOG.md b/CHANGELOG.md index c61adc9..d5cc1d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,17 +2,17 @@ _New Features:_ -- Added support for absolute paths in the `HIGHCHARTS_CACHE_PATH` option [(#562)](https://github.com/highcharts/node-export-server/issues/562) +- Added support for absolute paths in the `HIGHCHARTS_CACHE_PATH` option [(#562)](https://github.com/highcharts/node-export-server/issues/562). _Fixes_: -- Improved status codes (user errors instead of 500) [(#577)](https://github.com/highcharts/node-export-server/pull/577) - -- Improved memory management/usage [(#586)](https://github.com/highcharts/node-export-server/pull/586) +- Improved status codes (user errors instead of 500) [(#577)](https://github.com/highcharts/node-export-server/pull/577). +- Improved memory management/usage [(#586)](https://github.com/highcharts/node-export-server/pull/586). +- Corrected the `Node.js Module` example in the README. _Other:_ -- Add fair usage policy note on the page [(#583)](https://github.com/highcharts/node-export-server/pull/583) +- Add fair usage policy note on the page [(#583)](https://github.com/highcharts/node-export-server/pull/583). # 4.0.2 diff --git a/README.md b/README.md index 1b924df..3634b01 100644 --- a/README.md +++ b/README.md @@ -570,20 +570,24 @@ const options = { } }; -// Initialize export settings with your chart's config -const exportSettings = exporter.setOptions(options); -// Must initialize exporting before being able to export charts -await exporter.initExport(exportSettings); +// Logic must be triggered in an asynchronous function +(async () => { + // Initialize export settings with your chart's config + const exportSettings = exporter.setOptions(options); -// Perform an export -await exporter.startExport(exportSettings, async (error, info) => { - // The export result is now in info - // It will be base64 encoded (info.data) + // Must initialize exporting before being able to export charts + await exporter.initExport(exportSettings); - // Kill the pool when we are done with it - await exporter.killPool(); -}); + // Perform an export + await exporter.startExport(exportSettings, async (error, info) => { + // The export result is now in info + // It will be base64 encoded (info.result) + + // Kill the pool when we are done with it + await exporter.killPool(); + }); +})(); ``` ## CommonJS support