mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-23 13:37:59 +01:00
26 lines
454 B
CoffeeScript
26 lines
454 B
CoffeeScript
|
angular.module('ponyfm').factory('images', [
|
||
|
'$rootScope'
|
||
|
($rootScope) ->
|
||
|
def = null
|
||
|
self =
|
||
|
images: []
|
||
|
isLoading: true
|
||
|
refresh: () ->
|
||
|
return def if def
|
||
|
def = new $.Deferred()
|
||
|
|
||
|
self.images = []
|
||
|
self.isLoading = true
|
||
|
|
||
|
$.getJSON('/api/web/images/owned').done (images) -> $rootScope.$apply ->
|
||
|
self.images = images
|
||
|
self.isLoading = false
|
||
|
def.resolve images
|
||
|
|
||
|
return def
|
||
|
|
||
|
self.refresh()
|
||
|
return self
|
||
|
])
|
||
|
|