I think you guys are all missing the point. The js is running at an entirely
different time than the cf. You would make the lock around the session read
inside the js just exactly the same as if it was inside say a table cell.
You are generating js code, it's not being run at the same time as the cf
code. Cf is being run at the server level and js is being run at the client
level. Changing the scope around and moving the session read to a different
place would be fine, but there is no real problem to begin with. Throw a
cflock around the session read inside the js just like you would anywhere
else in a page. Now if you have several times during the page load that
you're reading from the same session var, then I can see setting a local var
to hold it's value to cut down on the locks and reads, but otherwise, it's a
waste of time/code.

-----Original Message-----
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Sent: Thursday, December 13, 2001 8:36 AM
To: CF-Talk
Subject: RE: lock var inside JS script?


To go one better you could move it to the request scope so that any
custom tags on the page will still have access to it as if it was a session
var.

Kola

Kola Oyedeji |Web Developer |ekeda
elthorne gate |64 high street |pinner |middx |ha55qa
t +44(208)429 7333 f +44(208)429 7339 |www.ekeda.co.uk


> -----Original Message-----
> From: Chris Bohill [mailto:[EMAIL PROTECTED]]
> Sent: 13 December 2001 14:31
> To: CF-Talk
> Subject: RE: lock var inside JS script?
>
>
> Set the session variable as a local variable at the top of
> the page, and
> lock this cfset.
>
> Then reference the local variable as you would the session, in the
> JavaScript. By doing this you only have to lock it once (at the top).
> Should not have any side-effects.
>
> HTH
>
> Chris Bohill
>
>
> -----Original Message-----
> From: Chris Norloff [mailto:[EMAIL PROTECTED]]
> Sent: 13 December 2001 14:29
> To: CF-Talk
> Subject: lock var inside JS script?
>
>
> I'm reviewing some code, and found a
> "<cfif not session.web_access>" inside a javascript function.
>
> I assume this read should be locked, but I'm not sure how to do it
> inside the js function.
>
> I could move session.web_access into another scope before the js
> function, but since it's someone else's code I'm wary of doing that
> because it could have effects I can't see now.
>
> Ideas?
>
> thanks,
> Chris Norloff
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to