MDN’s new design is in Beta! A sneak peek: https://blog.mozilla.org/opendesign/mdns-new-design-beta/

Promise.prototype

Terjemahan ini belum lengkap. Mohon bantu menerjemahkan artikel ini dari Bahasa Inggris.

Properti Promise.prototype mewakili prototype untuk kostruktor Promise.

Property attributes of Promise.prototype
Writable no
Enumerable no
Configurable no

Deskripsi

Instansi Promise diwariskan dari Promise.prototype. Anda bisa menggunakan objek prototype pada constructor untuk menambahkan properti atau method ke semua instansi Promise.

Properti

Promise.prototype.constructor
Mengembalikan fungsi yang membuat instansi prototype. Ini adalah fungsi Promise secara default.

Method

Promise.prototype.catch(onRejected)
Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled.
Promise.prototype.then(onFulfilled, onRejected)
Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler, or to its original settled value if the promise was not handled (i.e. if the relevant handler onFulfilled or onRejected is undefined).

Specifications

Specification Status Comment
ECMAScript 2015 (6th Edition, ECMA-262)
The definition of 'Promise.prototype' in that specification.
Standard Initial definition.
ECMAScript 2017 Draft (ECMA-262)
The definition of 'Promise.prototype' in that specification.
Draft  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 32 29.0 (29.0) No support 19 7.1
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile Chrome for Android
Basic support No support 29.0 (29.0) No support No support 8 32

See also

Tag Dokumen dan Kontributor

Tag: 
 Kontributor untuk laman ini: rmsubekti
 Terakhir diperbarui oleh: rmsubekti,