Reputation: 217
I am currently working with typescript and the new ECMAscript 6 feature Promise. My question is, can I use the Promise feature if my TypeScript gets compiled to a f.e. ECMAscript 3 js-file? I mean the Promise wasn't implemented at this version.
Upvotes: 1
Views: 420
Reputation: 6117
You can use a polyfill:
https://www.npmjs.com/package/es6-promise-polyfill
To install:
bower install es6-promise-polyfill
To use:
<script src="bower_components/es6-promise-polyfill/promise.min.js"></script>
<script>
var promise = new Promise(...);
</script>
Upvotes: 2