Doodle3D / Doodle3D-API

Doodle3D API for communication with the Doodle3D WiFi-Box
1 stars 0 forks source link

Remove jquery and use framework specificly for ajax calls or write own ajax calls #1

Open peteruithoven opened 9 years ago

peteruithoven commented 9 years ago

Remove jquery and use framework specificly for ajax calls or write own ajax calls.

Maybe we can use the upcoming fetch()? http://jakearchibald.com/2015/thats-so-fetch/

Looks like it isn't included in Babel, maybe we can use the following polyfill: https://github.com/github/fetch

peteruithoven commented 9 years ago

Slight downside is that it isn't Node.js compatible, but there is a Node.js specific alternative: https://github.com/bitinn/node-fetch Maybe, in the future we can do some kind of conditional platform check.

peteruithoven commented 9 years ago

In the mean time we've readded jQuery's ajax because fetch was lacking timeout functionality. A solution could be adding a timeout wrapper: https://github.com/github/fetch/issues/175#issuecomment-125779262

If we want to make the API universal/isomorphic we could use: isomorphic-fetch. But beside that it might be slightly easier to test (which I'm not sure of) I don't really see the point.

casperlamboo commented 9 years ago

Note that this is not a connection timeout. This is a response timeout. ... even if the timeout happens, the original request won't be aborted.

This means that when a gcode batch times out it's still plausible it is being send to the doodle box. The api will resend the batch and the same batch will be printed twice.