Closed moghya closed 7 years ago
I'm also getting this same issue using this code and octokat 0.9.0.
<html>
<body>
<script src="./bower_components/octokat/dist/octokat.js"></script>
<script>
var octo = new Octokat();
octo.repos('philschatz', 'octokat.js').fetch(function(err, repo) {
if (err) { return alert(err); }
alert(repo.url);
});
</script>
</body>
</html>
In 0.9
octokat switched to using the Fetch API which may require using a fetch polyfill.
It seems README.md
should be updated to clarify this because it seems that Internet Explorer does not support window.fetch(...)
Does the fetch
polyfill help resolve this problem?
Same issue on Chrome 58.0.3029.110 (64-bit).
TypeError: 'fetch' called on an object that does not implement interface Window.
Firefox get the above error on my app
I found a workaround:
const Octokat = require("octokat");
Octokat.Fetch = (...args) => {
return window.fetch(...args);
};
Should this
of fetch
be window
?
Similar issues?
try the 2 suggestions, still not work. donwgrade to version 0.8 solved my problem!
Thanks for reporting this and sorry about the late reply.
Oops 😊 ! This was missed in the tests because they use a different implementation of fetch that does not raise this error. It should be resolved in 0.9.1
.
You can also include Octokat.Fetch = window.fetch.bind(window)
to get around the issue.
Closing for now but if this problem still occurs please comment.
I'm trying to use Octokat for a simple purpose, I tried examples for browser and getting this error. I understand using callbacks is intended use but in that case, every time I'm getting the undefined result.
Please help.