what difference between using:
new rsvp.promise() (docs)
and
new promise() (docs)
in ember app?
are aliases?
the first 1 creates new rsvp promise. rsvp promises es6/a+ compliant, it's polyfill (with features). nothing wrong doing method.
the second case depends on scope code called. if have var promise = rsvp.promise; somewhere, mean same thing. however, if haven't declared promise yourself, fall browser implementation (if 1 exists). because rsvp es6/a+ compliant, wouldn't notice if browser implementation used (unless you're using custom rsvp methods).
short answer long: might mean same thing, might not.
personally, second method better because when rsvp removed , browser implementation used, no code have change. window.promise = window.promise || ember.rsvp.promise @ start of script polyfill. if that, sure use methods listed on this page, not rsvp methods.
Comments
Post a Comment