Skip to content

Commit

Permalink
Make writefile sync
Browse files Browse the repository at this point in the history
  • Loading branch information
javaguirre committed Aug 30, 2016
1 parent 6b25435 commit 3c29729
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions lib/rest-client-persist.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@ class RestClientPersist

saveFile: ->
requestsToBeSaved = @get(@requestFileLimit)
fs.writeFile(
fs.writeFileSync(
"#{@path}",
JSON.stringify(requestsToBeSaved),
@showErrorOnPersist
)
JSON.stringify(requestsToBeSaved))

update: (requests) ->
@requests = requests
Expand All @@ -53,15 +51,7 @@ class RestClientPersist
requestEquals: (request1, request2) ->
return (request1.url == request2.url and
request1.method == request2.method)


showErrorOnPersist: (err) =>
if err
atom.confirm(
message: 'Cannot save file: ' + @path,
detailedMessage: JSON.stringify(err)
)


getRequestFileLimit: () ->
return @requestFileLimit

Expand Down

0 comments on commit 3c29729

Please sign in to comment.