Closed rwaldron closed 7 years ago
Good to know. Will need to track this.
Just for some more information:
In Gecko, the isGenerator
function is a method of the Function
prototype. Since Function instanceof Function === true
, Function.isGenerator()
returns whether the constructor Function
is a generator, which always resolves to false.
Since Function.isGenerator(maybeGeneratorFunction)
is only available on the Function
constructor object as proposed, a polyfill should be able to avoid a false positive on Firefox by using the following check:
if (!Object.hasOwnProperty.call(Function, 'isGenerator') || typeof Function.isGenerator !== 'function') {
// polyfill `Function.isGenerator`
}
Edit: For clarification, Function.isGenerator
is not defined in this proposal.
This will be true of any methods on Function.prototype
- it'd have to be just Function.isGenerator
, so that you'd never call foo.isGenerator()
, but instead Function.isGenerator(foo)
.
Don't believe we need to continue tracking this with the current proposal
In Spider-Monkey: