Answer the question
In order to leave comments, you need to log in
How to run js promise on local machine?
Good afternoon. I understood promises from the lessons of Ilya Kantor, articles on Habré, the Plunker sandbox. The problem is that none of the sandbox promise code works on my local machine. The situation is aggravated by the fact that I do not understand how all sorts of collectors work.
Installed bower with npm ---> npm install es6-promise -g (installed) ---> bower install es6-promise --save (No .json file to save to, use bower init to create one) --- > bower init (Result: fill in name, keywords, license, etc.) ---> Created a .json with the content I entered. Many other files have also been created in the bower_components folder. I don't know what to do with all of them and why code with promises from other folders doesn't work if npm install es6-promise -g. Where does it actually need to be in order to work?
Everyone else (Kantor, Habr) writes about some polyfills, but I don’t understand why they are and what they do when there is an es6-promise ... which, for some reason, does not work.
Help, please, to understand.
PS Promises support cross-domain requests?
Answer the question
In order to leave comments, you need to log in
firstly, show the code,
I hope you are not in IE trying to run these examples? promises are supported in all normal browsers caniuse.com/#feat=promises es6
-promise which you set, this is the same polyfill, should be in the bower_components/es6-promise folder, you just need to connect the es6-promise.js file to the page from there ... but again, for all browsers except IE it is not needed
A polyfill is a file that provides browser support for an unsupported property, specifically here - promises. If you run through supported browsers ( caniuse.com/#feat=promises) then you don't need it. But in production, as a rule, you need to connect it. If you don’t go deep into assemblers and loaders, then it’s enough to connect it with a regular tag
<script src="bower_components/es6-promise/es6-promise.min.js"></script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question