Skip to content

Commit

Permalink
Permit a complete callback when opening a file
Browse files Browse the repository at this point in the history
to allow consumers to specify code to always run, after a successful or
errorful opening of a file
  • Loading branch information
clalimarmo committed Feb 18, 2015
1 parent bb5bed8 commit 2c27a82
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/json-gcs.js

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

1 change: 1 addition & 0 deletions lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ define(function() {
_handlers.success();
}
};
handlers.complete = _handlers.complete;
datastore.get(_filename, handlers);
};

Expand Down
4 changes: 3 additions & 1 deletion lib/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ define(function(require) {
data: requestBody,
success: opts.success,
error: opts.error,
complete: opts.complete,
}
);
};
Expand All @@ -89,7 +90,8 @@ define(function(require) {
}
handlers.success(json);
},
error: handlers.error
error: handlers.error,
complete: handlers.complete,
}
);
};
Expand Down
4 changes: 2 additions & 2 deletions spec/json_gcs_spec.coffee
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
define (require) ->
JsonGCS = require('json-gcs')

describe 'JsonGCS', ->
describe 'JsonGCS.Storage', ->
mocks = {}
instance = null

Expand All @@ -12,7 +12,7 @@ define (require) ->
}
mocks.http = {}

instance = JsonGCS(
instance = JsonGCS.Storage(
http: mocks.http
authenticator: mocks.authenticator
bucketName: 'my-bucket'
Expand Down

0 comments on commit 2c27a82

Please sign in to comment.