W3C home > Mailing lists > Public > public-media-capture@w3.org > February 2015

Request: Demo of a Javascript Promise?

From: Harald Alvestrand <harald@alvestrand.no>
Date: Thu, 26 Feb 2015 10:04:46 +0100
Message-ID: <54EEE1AE.5040005@alvestrand.no>
To: "public-media-capture@w3.org" <public-media-capture@w3.org>
I've tried to experiment a little with Javascript promises, but have
come to the conclusion that I still don't understand them.

I wonder if someone has a simple demo I can look at?
What I would want is a Web page that has:

- A function that returns a promise and installs success and failure
callbacks on it.
- A button that says "resolve" - when I push it, the promise's success
function is called, and the promise is resolved.
- A button that says "cancel" - when I push it, the promise's failure
function is called, and the promise is rejected.

I tried to write something like that, but my failure to achieve what I
wanted indicates that there's still something I don't understand.

        Harald
Received on Thursday, 26 February 2015 09:05:20 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 26 February 2015 09:05:21 UTC