Skip to content
This repository has been archived by the owner on Jan 18, 2021. It is now read-only.

Add async/await example #16

Merged
merged 1 commit into from
Feb 23, 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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,16 @@ sprLib.user().info()
.catch(errMsg => console.error(errMsg));
```

You can also use the async/await syntax (available in recent browsers and Node.JS 8.6+, or via transpiling with BabelJS):

```javascript
const infoGetter = async () => {
// EX: Get the current user's ID, then get their Tasks
const objUser = await sprLib.user().info();
const arrItems = await sprLib.list('Tasks').getItems({ queryFilter:'Owner/Id eq ' + objUser.Id });
console.log("Current user's Tasks = " + arrItems.length);
}
```

**************************************************************************************************
# Installation
Expand Down