Skip to content

Commit

Permalink
Update example to use ESM module export syntax.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonkearns committed Sep 25, 2023
1 parent 7afe008 commit 968a7da
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/BackendTask/Custom.elm
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,23 @@ we're using `BackendTask.allowFatal` to let the framework treat that as an unexp
```javascript
// custom-backend-task.js
module.exports =
/**
* @param { unknown } fromElm
* @returns { Promise<unknown> }
*/
{
environmentVariable: async function (name) {
const result = process.env[name];
if (result) {
return result;
} else {
throw `No environment variable called ${name}
/**
* @param { string } fromElm
* @returns { Promise<string> }
*/
export async function environmentVariable(name) {
const result = process.env[name];
if (result) {
return result;
} else {
throw `No environment variable called ${name}
Available:
${Object.keys(process.env).join("\n")}
`;
}
},
}
}
}
```
Expand Down

0 comments on commit 968a7da

Please sign in to comment.