Closed rorticus closed 7 years ago
I like where this is headed, but I don't like exposing streamHandlers
from dojo-core/request/node
. What if that was made a property of NodeRequestOptions
, then dojo-streams/request
could wrap dojo-core/request/node
and pass in streamHandlers
for the user:
export function request(url, options) {
return nodeRequest(url, {
streamHandlers: {
streamDataHandler: nodeStreamDataHandler,
streamTargetHandler: nodeStreamHandler,
streamCompleteHandler: nodeStreamCompleteHandler
},
...options
});
}
I like that. So dojo-streams
would import dojo-core
and not the other way around.
Right, and there wouldn't be an object left out in the open (streamHandlers
) that could get hijacked
PR is over here in dojo-streams
, https://github.com/dojo/streams/pull/6
Finished with https://github.com/dojo/streams/pull/6
We want to remove the dependency on dojo/streams, since it is a lot of code for as little as it will be used. Right now its only used in
request/node
.One possible approach is to use dependency injection...
request/node
has a dependency ondojo/streams
right now. That’s pulling in a lot of code for a feature that most people will not be using. We need to remove that dependency and instead force people to manuallydojo/streams
if they want to use the node request provider with astreamTarget
.A desired usage would be something like,
node
inrequest/node
to allow setting a stream target handler and a stream target completion handler.request/node
and move it out intodojo/streams
somewhere.request/node
indojo/streams
.You can see an rough implementation here, https://github.com/dojo/core/compare/master...rorticus:no-streams https://github.com/rorticus/streams/compare/no-streams