mirror of
https://github.com/wassname/side-by-side.git
synced 2026-09-22 13:40:40 +08:00
Add fetcher
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
angular.module("sideBySide").factory "fetch", ['$http', 'readerFactory', ($http, readerFactory) ->
|
||||
# Fetch
|
||||
#
|
||||
# @param file [String] Path to config file
|
||||
# @return TODO
|
||||
return (file = "config.json") ->
|
||||
$http.get(file).then((response) ->
|
||||
promises = []
|
||||
for poem in response.data.files
|
||||
promises.push($http.get(poem).then((response) ->
|
||||
reader = readerFactory(poem)
|
||||
return reader(response.data)
|
||||
))
|
||||
return promises
|
||||
)
|
||||
]
|
||||
Reference in New Issue
Block a user