Skip to content

Commit

Permalink
Updated the Node.js Module example in the README, touch #563.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulDalek committed Aug 6, 2024
1 parent e740944 commit 8ba67b9
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,20 +568,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.data)
// Kill the pool when we are done with it
await exporter.killPool();
});
})();
```

## CommonJS support
Expand Down

0 comments on commit 8ba67b9

Please sign in to comment.