-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor internals to use event based callbacks #22
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit includes many changes to internal systems, namely: * AWS.RequestHandler was removed. Its logic was moved into AWSRequest * AWS.AWSRequest is now an EventEmitter emitting the following events: - validate - build - sign - send - httpHeaders - httpData - httpDone - retry - error - success - complete * Added AWS.EventListeners namespace to keep track of named events that are added to services * Converted all AWS.Client subclasses (QueryClient, RESTXMLClient, etc.) into AWS.ServiceInterface.* modules implementing 3 methods: - buildRequest (for build event) - extractError (for extractError event) - extractData (for extractData event) These methods match the events they listen to (named above), and are registered by the equivalently named modules in AWS.EventListeners.* The separation is for testing. The request building and data extraction can now be tested individually for a service interface format without requiring the event emitter infrastructure: var client = new AWS.Client(); var req = new AWS.AWSRequest(client, 'operation', params); AWS.ServiceInterface.Json.buildRequest(req, req.response); * Some tests were disabled (renamed *.off). These tests still need to be updated to use the new infrastructure for testing. This is a TODO.
Event is removed when another httpData event is registered. Also re-orders httpData arguments (chunk first)
* Change signatures for event emitters * Request can now send() multiple times without async issues.
No longer passing `request` to any other events, use `this` to access the AWSRequest object from an event instead.
trevorrowe
added a commit
that referenced
this pull request
Jan 3, 2013
Refactor internals to use event based callbacks
nhinds
added a commit
to nhinds/aws-sdk-js
that referenced
this pull request
Jan 12, 2016
These were removed in aws#22
chrisradek
added a commit
that referenced
this pull request
Jan 12, 2016
srchase
added
feature-request
A feature should be added or improved.
and removed
enhancement
labels
Jan 4, 2019
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Major changes:
(X) = backward incompatible
AWS.Client
and use event registration to determine their service interfaceAWS.ServiceInterface
namespace implementing the three methods: