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

Commit

Permalink
Merge pull request #16 from wmertens/patch-1
Browse files Browse the repository at this point in the history
Add async/await example
  • Loading branch information
gitbrent authored Feb 23, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 4115564 + ccb4375 commit e39c42f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e39c42f

Please sign in to comment.