You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, prototype methods are visible to the outside world, essentially public. It is common pattern to put private methods on prototype, but prefix with an underscore. i.e. Promise.prototype._privateFunc.
Since this library is a polyfill, I tried to make it as close to the built-in Promise as possible. The built-in Promise doesn't expose any underscore methods.
You can make true private methods using a closure and calling it like fn.apply(this, args). You still get the same performance benefits as the prototype methods, but the functions are not exposed to the outside world on the prototype. Does that make sense?
Is there a reason why some of your methods in prototype and some not?
The text was updated successfully, but these errors were encountered: