W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2007

[whatwg] Progress Events "done" event

From: Křištof Želechovski <giecrilj@stegny.2a.pl>
Date: Mon, 27 Aug 2007 09:26:55 +0200
Message-ID: <000d01c7e87b$aabb1fc0$4d01010a@IBM42F76C011DF>
Remember that JavaScript is a programming language after all.  You can use a
loop to get rid of the repetitions.
Start from
var done = ["load", "error", "abort"]...
and apply the closure image.aEL(?, hPB, false) to it.

-----Original Message-----
From: whatwg-bounces@lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Garrett Smith
Sent: Sunday, August 26, 2007 8:25 AM
To: whatwg at whatwg.org
Cc: chaals at opera.com
Subject: [whatwg] Progress Events "done" event

function showImage(imageHref) {

// remove the progress bar when done.
       image.addEventListener("load", hideProgressBar, false);
       image.addEventListener("error", hideProgressBar, false);
       image.addEventListener("abort", hideProgressBar, false);

This is somewhat verbose. Clearly, the author is forced to repeat
himself when all he really wants to do is hide the progress bar after
the call is done.
Received on Monday, 27 August 2007 00:26:55 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:36 UTC