goodeggs / angular-cached-resource

An AngularJS module to interact with RESTful resources, even when browser is offline
MIT License
216 stars 29 forks source link

Add single query to detect presence of offline data #34

Open adamtwiss opened 10 years ago

adamtwiss commented 10 years ago

In an app that supports offline mode, it is arguably good practice/UX to visually indicate that there is offline data.

Whilst you can do: " MyResource.$writes.queue.length" for each different cached resource, this is a bit ugly (see my updated to #24 that $writes.count appears not to work)

I think it would be nice if you could do $cachedResource.numOfflineUpdates() and it return a number of the total write queues across all models.

If it is thought worthwhile I am happy to have a go at implementing.

hazeledmands commented 10 years ago

:+1:, this is awesome. Go ahead, pull requests gladly accepted. Can we call it totalPendingWrites instead of numOfflineUpdates, though?

Thanks for pointing out #24, too, I'll take a look at it today; MyResource.$writes.count is definitely supposed to be the way to check the queue length for a single resource.

MatthieuBarthel commented 9 years ago

Looking for the same thing here, I didn't succeed yet. BTW thank you for this awesome library :+1: