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

setImmediate compatibility in IE10 #1163

Closed
kwonoj opened this issue Jan 11, 2016 · 7 comments · Fixed by #1164
Closed

setImmediate compatibility in IE10 #1163

kwonoj opened this issue Jan 11, 2016 · 7 comments · Fixed by #1164

Comments

@kwonoj
Copy link
Member

kwonoj commented Jan 11, 2016

among major browser engines, IE10 (and above, IE11) have implementation of window.setImmediate (https://developer.mozilla.org/ko/docs/Web/API/Window/setImmediate) and current implementation of RxJS immediate tries to utilize it. Currently it has 2 issues

  • current codebase cannot call window.setImmediate
    : our codebase assigns it as
if (root.setImmediate) {
      this.setImmediate = root.setImmediate;

which brings error like below

IE 11.0.0 (Windows 10 0.0.0) AsapScheduler should schedule an action to happen later FAILED
        TypeError: Invalid calling object

reason of IE's behavior (https://msdn.microsoft.com/library/gg622930(v=vs.85).aspx).

confirmed as 'won't fix'.

Possible options

  • solve RxJS side issue only (calling setImmediate), let user decide to use window.setImmediate or not explicitly
  • ignore window.setImmediate and use polyfill (onreadystatechange?)
@kwonoj
Copy link
Member Author

kwonoj commented Jan 11, 2016

My vote is to ignore window.setImmediate by it's already known to not to be fixed in further.

@kwonoj
Copy link
Member Author

kwonoj commented Jan 11, 2016

related with #998.

@mattpodwysocki
Copy link
Collaborator

@kwonoj that's not what the error is telling you, it's telling you it's unbound to the proper object. None of the issues you state above aren't related to this error. In this case, our code should be:

if (typeof root.setImmediate === 'function') {
  this.setImmediate = root.setImmediate.bind(root);
}

The problem is that you were unbound to the root for setImmediate which is a bug in the code. RxJS v4 has used setImmediate since IE10 included it and it works just fine.

@kwonoj
Copy link
Member Author

kwonoj commented Jan 11, 2016

@mattpodwysocki What I was thought about first case was regarding below in https://msdn.microsoft.com/library/gg622930(v=vs.85).aspx, seems I was misunderstood about those.

The long term fix for this is to use JavaScript's bind API to associate an implicit calling object 
with the method. This is done as follows (again, drawing on the previous example): 

var d = document.writeln.bind(document);
d("<script language=VBScript>"); // Now this is OK.

For second item, it is said behavior of window.setImmediate itself - can we consider it's not problematic?

@mattpodwysocki
Copy link
Collaborator

@kwonoj no, it's not any more problematic than any other host object. See the requestAnimationFrame wrapper made by @trxcllnt https://github.com/ReactiveX/RxJS/blob/rxjs-dom/src/util/AnimationFrame.ts#L8-L9

@kwonoj
Copy link
Member Author

kwonoj commented Jan 11, 2016

Appreciate for clarification. I'll use this issue to update code base as suggested by second issue (I thought as issue) is not relevant.

@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants