Skip to content
Open
Show file tree
Hide file tree
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
17 changes: 12 additions & 5 deletions angular-pouchdb.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,18 @@ pouchdb.provider 'pouchdb', ->
bulkDocs: qify db.bulkDocs.bind(db)
allDocs: qify db.allDocs.bind(db)
changes: (options) ->
clone = angular.copy options
clone.onChange = (change) ->
$rootScope.$apply () ->
options.onChange change
db.changes clone
changes = db.changes options
deferred = $q.defer()
changes.on 'change', (change) ->
$timeout () ->
deferred.notify {change: change, changes: changes}
changes.on 'complete', (res) ->
$timeout () ->
deferred.resolve res
changes.on 'err', (err) ->
$timeout () ->
deferred.reject(err)
deferred.promise
putAttachment: qify db.putAttachment.bind(db)
getAttachment: qify db.getAttachment.bind(db)
removeAttachment: qify db.removeAttachment.bind(db)
Expand Down
28 changes: 21 additions & 7 deletions angular-pouchdb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.