Skip to content
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

Invalid calling object #20

Closed
cary-smith opened this issue Sep 6, 2017 · 9 comments
Closed

Invalid calling object #20

cary-smith opened this issue Sep 6, 2017 · 9 comments
Labels

Comments

@cary-smith
Copy link

cary-smith commented Sep 6, 2017

First and foremost: Nice implementation!
Second: I really do not want to make a request for IE11 but.....

I have just started to use this to decouple our library from framework cycles (like $digest in angular) but have run into a small issue when hot-reloading while running locally. Due to our use of use strict, IE11 cannot figure out what 'this' is for the requestAnimationFrame. This does not affect the final build.

It is extremely similar to vuejs/vue#4465

Any chance you would be willing to ensure window objects are referenced? I would make a pull request but seem unable to at the moment.

Thanks!

@finngl
Copy link

finngl commented Sep 28, 2017

I also get "Invalid calling object" in IE. For me this is not a small issue, though, since in my case it prevents the polyfill from working. I'd be very happy to see a solution soon - thanks!

@rssfrncs
Copy link

rssfrncs commented Oct 4, 2017

Yes, i get this problem in IE11 for a Vue project during development but it works flawlessly when built.

@que-etc
Copy link
Owner

que-etc commented Oct 5, 2017

@paulie4, @occamsraiser, @eeeps, @marchaos

Hi guys!

First things first, I'm terribly sorry for being such an ass and ignoring all your bug tickets. I had some personal issues to deal with. Now I'm mostly back on track and I'll respond or publish a fix for all of the tickets till the beginning of the next week.

@cary-smith, it seems that I see the problem though I don't how to reproduce it. Any ideas on how it can be done so that I can verify that the bug is fixed? Thanks.

@que-etc que-etc added the bug label Oct 5, 2017
@rssfrncs
Copy link

rssfrncs commented Oct 5, 2017

@que-etc

To mirror my setup you could scaffold a VueJS progressive web app project using vue-cli.

npm install vue-cli -g
vue init pwa resize-bug
// say no to testing, linting, routing
cd resize-bug
npm run start

Not sure if you are familiar with VueJS, if not add the following to src/App.vue,

<template>
  <div></div>
</template>

<script>
import ResizeObserverfrom 'resize-observer-polyfill'
export default {
  mounted() {
    const ro = new ResizeObserver((entries, observer) => {
      // not important for testing
      console.log(entries)
    });
   // root element defined in <template> above
    ro.observe(this.$el);
  }
}
</script>

I am able to reproduce this on demand, by using the start script, using the polyfill within a Vue component and viewing in IE11.

@jspath
Copy link

jspath commented Oct 10, 2017

I am also experiencing this issue in IE11 in a preact/webpack app I am working on.

Binding the window object to requestAnimationFrame in src/shims/requestAnimationFrame.js fixes it for me:

export default (() => {
    if (typeof requestAnimationFrame === 'function') {
        return requestAnimationFrame.bind(window);
    }

    return callback => setTimeout(() => callback(Date.now()), 1000 / 60);
})();

Not sure if this is an acceptable solution or not, but it does seem to work without any ill effects.

@cary-smith
Copy link
Author

@jspath is right which is also similar to the approach taken to fix the vuejs issue.

You could also use your isBrowser check from utility.

Any chance that could be applied?

que-etc added a commit that referenced this issue Nov 16, 2017
@que-etc
Copy link
Owner

que-etc commented Nov 17, 2017

@cary-smith

I've released a patch in v1.5.0. Sorry that it took me so long.

Could anyone confirm that the problem is solved?

@cary-smith
Copy link
Author

Works like a charm! Thank you for the update.

...And don't apologize for the timing. This has saved me a ton of time and IE11 will hopefully be a memory soon.

@que-etc
Copy link
Owner

que-etc commented Nov 17, 2017

Closing it then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants