jimhigson / oboe.js

A streaming approach to JSON. Oboe.js speeds up web applications by providing parsed objects before the response completes.
http://jimhigson.github.io/oboe.js-website/index.html
Other
4.79k stars 208 forks source link

Full example please #185

Closed fulldecent closed 5 years ago

fulldecent commented 5 years ago

The first example at http://oboejs.com/examples is listed as:

oboe('/myapp/things.json')
   .done(function(things) {

      // we got it
   })
   .fail(function() {

      // we don't got it
   });

This is a fragment of an example. Instead, could a full, usable example please be presented. Including instructions on how to compile/run it.

fulldecent commented 5 years ago

Anyway, this is as far as I got and I couldn't get it to work.

https://codepen.io/anon/pen/XGVNMP?editors=0012

Sphinxxxx commented 5 years ago

This would probably be better as a question on Stack Overflow.

Anyway, your code is actually correct. The problem is that you're trying to load JSON from an unsecure http address into a secure https CodePen page, which the browser doesn't allow (you need to open the browser console to see that error message - the CodePen console doesn't show those errors).

Just change the JSON url to httpS://httpbin.org/stream/1, and your example works.

fulldecent commented 5 years ago

Thank you, this is the full working example.

https://codepen.io/anon/pen/bZJEEM?editors=0012

Free to use it in the documentation if wanted.