Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #21065
| From | Ken <usenet-so@abdiassoftware.com> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Multiple image preload construct? |
| Date | 2013-08-27 18:43 -0500 |
| Organization | Abdias Software |
| Message-ID | <kvjdm7$50d$1@speranza.aioe.org> (permalink) |
| References | <kvidas$lib$1@news.albasani.net> <kvire7$ca3$1@speranza.aioe.org> <2725916.yAnYnyUf7L@PointedEars.de> |
On 27.08.2013 16:02, Thomas 'PointedEars' Lahn wrote: > That is awful code style for array iteration, in probably every language of > the C family. Consider this instead: Oh, this is not C, this is ECMAScript in the JavaScript flavor, a dynamic language. Nothing is compiled, everything is interpreted. If you understand how interpreting works you would know this doesn't really matter (and in this case the bottleneck is not the loop). > It makes more sense to append the object reference to the Array *after* the > object is prepared: Doesn't matter at all in this case. The Image element is a valid reference before src is set and image loading is an asynchrounous operation in JavaScript. If its reference is kept in an array, object or as a variable does not matter at all as long as it is referenced. Look at Image element as parent of data, not part of it. > It is even questionable to have the Image instance references in an Array, > as then there is no random access to them, for example by name or ID. I think you are forgetting that you can use the URL to identify which image has loaded if you need to reference its index. > In your code you declare 3 global properties that should be avoided by using > namespacing (for lack of a better word): You are missing the point here. I am not providing a full working solution but an example. It's up to OP to modify and adopt to suit his needs. > Consider ... > You could also count upwards ... > Function expressions are widely supported by now ... > Using your way is only necessary with event-handler properties ... I am not sure how any of this significantly improves anything (if at all), but thanks for your opinions. -- Ken Fyrstenberg Abdias Software http://abdiassoftware.com/ (remove usenet- from address)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Multiple image preload construct? Tuxedo <tuxedo@mailinator.com> - 2013-08-27 16:32 +0200
Re: Multiple image preload construct? Tuxedo <tuxedo@mailinator.com> - 2013-08-27 17:06 +0200
Re: Multiple image preload construct? Danny <dann90038@gmail.com> - 2013-08-27 10:29 -0700
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 13:32 -0500
Re: Multiple image preload construct? Tuxedo <tuxedo@mailinator.com> - 2013-08-27 20:54 +0200
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 18:19 -0500
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-28 01:37 +0200
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 18:47 -0500
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-27 23:02 +0200
Re: Multiple image preload construct? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-08-27 23:20 +0200
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-28 01:27 +0200
Re: Multiple image preload construct? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-08-29 03:56 +0200
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-29 15:16 +0200
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 18:43 -0500
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-28 02:08 +0200
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 19:49 -0500
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-28 03:17 +0200
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 20:35 -0500
Re: Multiple image preload construct? Dr J R Stockton <reply1300@merlyn.demon.co.uk.invalid> - 2013-08-29 19:32 +0100
Re: Multiple image preload construct? John Harris <niam@jghnorth.org.uk.invalid> - 2013-08-28 16:20 +0100
Re: Multiple image preload construct? Andrew Poulos <ap_prog@hotmail.com> - 2013-08-28 11:21 +1000
Re: Multiple image preload construct? Ken <usenet-so@abdiassoftware.com> - 2013-08-27 20:48 -0500
Re: Multiple image preload construct? Andrew Poulos <ap_prog@hotmail.com> - 2013-08-28 13:43 +1000
Re: Multiple image preload construct? John Harris <niam@jghnorth.org.uk.invalid> - 2013-08-29 10:00 +0100
Re: Multiple image preload construct? Andrew Poulos <ap_prog@hotmail.com> - 2013-08-30 07:25 +1000
Re: Multiple image preload construct? John Harris <niam@jghnorth.org.uk.invalid> - 2013-08-30 10:11 +0100
Re: Multiple image preload construct? Christoph Michael Becker <cmbecker69@arcor.de> - 2013-08-28 02:17 +0200
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-28 02:38 +0200
Re: Multiple image preload construct? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-08-28 11:04 +0200
Re: Multiple image preload construct? John Harris <niam@jghnorth.org.uk.invalid> - 2013-08-28 16:26 +0100
csiph-web