Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Sign In

hoodiehq / hoodie-account-client / 445
100%
master: 99%

DEFAULT BRANCH: master
Build:
LAST BUILD BRANCH: greenkeeper/uglify-js-3.9.4
Repo Added 25 Mar 2016 10:17PM UTC
Total Files 32
# Builds 732 Last
Badge
Badge Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Dec 2016 - 0:16 coverage remained the same at 100.0%
445

Pull #129

travis-ci

9181eb84f9c35729a3bad740fb7f9d93?size=18&default=identiconweb-flow
feat: `options.store` and `account.ready`

BREAKING CHANGE:

As part of our effort to make Hoodie Client compatible with Service Worker and other environments that do not have access to localStorage, we have to make the Account Client compatible with async store APIs. That means we can’t load the current account state synchronously, so this is no longer be possible:

```js
var account = new Account({
  url: /api
})
if (account.isSignedIn()) {
  sayHi(account.username)
}
```

Starting with this release, you have to wrap the synchronous methods and properties into `account.ready.then()`

```js
account.ready.then(function () {
  if (account.isSignedIn()) {
    sayHi(account.username)
  }
})
```

By default, the account will still use localStorage (via [humble-localstorage](https://github.com/gr2m/humble-localstorage)) to persist its state, but it will now be made asynchronous. In order to use another storage a new `options.store` argument can be passed to the Account constructor:

```js
var account = new Account({
  url: /api,
  store: {
    set: writeAccountState
    get: getAccountState,
    unset: clearAccountState,
  }
})
```

All three `options.store` methods must return promises. `store.get` must resolve with the persisted account properties or an empty object.
Pull Request #129: async store

116 of 116 new or added lines in 24 files covered. (100.0%)

507 of 507 relevant lines covered (100.0%)

7.47 hits per line

Jobs
Coverage Job Files Covered Ran
100.0
445.1 32 23 Dec 2016 12:17AM UTC Travis Job 445.1
Source Files on build 445
  • List 32
  • Changed 29
  • Source Changed 24
  • Coverage Changed 29
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Travis Build #445
  • Pull Request #129
  • PR Base - camp/101 (#443)
Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
BLOG · TWITTER · Legal & Privacy · Supported CI Services · What's a CI service? · Automated Testing

© 2022 Coveralls, Inc