Hi Marc,
Thanks for the reply
Quote:
Just my two cents:
>
Keep on reading about JavaScript, eventually you'll find that using frames
can be a bit of a pain to handle...
You seem confident; all of my experience to date (admittedly somewhere shy
of oodles :-) has been to the complete contrary! Frames, at least to me, are
an incredibly useful addition to the Web Client armoury, and provide a level
of JavaScript code demarcation, or segmentation, and modularity that I find
difficult to conceive of elsewhere.
Quote:
Instead, think of getting rid of the frames and start learning
xmlhttprequest. (or the so popular term ajax)
Marc, before I launch into a rant, can you please point out why you think
that I should deploy the cheese to solve my problem rather than the chalk?
Or why a deployment of xmlhttprequest has to be to the mutual exclusion of
Frames and vice versa? What is it, functionality wise, that you imagine that
I'm doing with Frames that can be solved with one wave of Ajax? (I certainly
do not "Submit" anything!)
<rant>
But In all honesty I would rather stick my head in a boiling chip-pan than
attempt to shoe-horn an ill-conceived, context-devoid, and feature-starved,
pile-of-pooh (such as http) into the role of Application Middleware
Protocol! Cookies? Session IDs? Caching of Passwords? Domain-wide
contextless client Authorization? All frightening stuff!
Just my 2c :-)
</rant>
Quote:
Q1
Do not duplicate functions as this can be more trouble worth it, store all
functions in one js file and load it in the parent frame.
Emotionally, I'm on the same hymn-sheet as you with this but do we have any
tangibles to go on? In my particular case I was thinking of my Socket read
routines (Where all context its maintained in the Applet object anyway). I
can see the Applet and all its methods from any Frame so is there any
overhead or other pros/cons of having a local copy of a function that says
inBytes = chan.readMessage(howMany) or call a single common routine
inBytes=parent.mainFrame.getData(howMany)?
If I went the first way, I suppose I'd really have to say
parent.mainFrame.chan.readMessage(inBytes) other wise I'd have to initialize
"chan" somewhere locally with a getElementById("applet") or chan =
parent.mainFrame.chan and it's that desire for one-off initialization that
led to question 2.
I think I'll take your advice on this one. Thanks.
Quote:
Q2
There's no predictable load. Perhaps having a timer in the main frame
checking out if a certain variable is available in it's child frames is a
way to go (and indeed using the child frame onload).
That's interesting. OK, I'm walking away with I have to re-initialize my
variables each time before the previous Frame hands-over (by calling
frameB.getReady()) or I simply have to use global variables that were
initialized in the manFrame. I can live with that.
Quote:
Consider the following, someone is using your application, filling out all
sorts of stuff, calculations are being made and stored in variables... but
then, oh horror... he/she presses F5, everything reloads... and the 'fun'
starts all over again...
Ok, let's consider it; no, let's discuss what actually happens. After
pressing refresh my Applet's destroy() method gets invoked and I close the
socket connection to the server. Client/Server affinity is managed at that
end and if a request was currently being actioned by a server process then
that process is sent an Asynchronous System Trap (AST) telling it that the
connection is dead, and any future attempts to send data back to the client
will be met with a t3$_chanclose status. (This is similar functionality to
the hot-abort key that I spoke of earlier. If the user is sick of waiting
they hit the cancel button and an OOB is sent (if possible) to the server. I
use the setSoTimeout() method, for "long" queries so that an erstwhile
blocking read can surrender the thread for other event (such as the cancel
button) processing. Otherwise the "cancel" occurs between reads. <--
Context-Rich protocol!)
The browser then reloads the original page(s) and my Applet's init() method
gets called, and I, once again, send up a modal dialogue box asking the user
to logon an re-authorize. (Username/Password)
I certainly like it! (But maybe that's just me :-)
Thanks again.
Cheers Richard Maher
PS. If they don't want to logon again then simply don't hit refresh. Or
don't close the browser, or don't turn off the PC, or. . .
"Marc" <sorrygot@dirtymail.comwrote in message
news:8e74d$4623ae8a$3e6c11a9$32370@news.chello.nl. ..
Quote:
>
"Richard Maher" <maher_rj@hotspamnotmail.comwrote in message
news:f003cb$b73$1@news-01.bur.connect.com.au...
Quote:
Hi,
Now that I am aware that JS on a page in Frame A can directly call a
function on a page in Frame B, I no longer have to continue with my
frameB.location.reload() fudge in order to get some code to run in B's
context. This is fantastic news, and I'm having a ball!
But before running off with all my convert's zeal and converting all my
<script src="common.js"copy-books to direct parent.frame.function()
calls
I'd like to pause for a moment as ask everyone if you think it makes
sense?
If I was on the mainframe there would be no question and I'd go for the
Shareable-Image/DLL 99.8% of the time; everyone sees the same copy in
memory
and they pick up any new version the next time they run. But does it
make
Quote:
Quote:
that much difference, here in JS linkerless interpreter-land, that each
page
has its own local copy of function(s) and data?
To pose the question another way, If a given function is stateless
(non-variant is the closest SQL expression that comes to mind) is there
any
point in FrameB calling a parent.frameA.function1 rather than having
it's
Quote:
Quote:
own copy of function 1? Now if function1 was stateful and maybe keeping
a
Quote:
Quote:
counter of all calls from all frames, then clearly there are logic
reasons
Quote:
Quote:
why this keeper of the Global knowledge should have only one instance,
but
Quote:
Quote:
if it just takes some parameters and returns a result (or affects the
screen) then who cares?
Few more bytes of memory? Extract another.JS file to upload? (but what
about
the first time being cached?) Neatness? Goodness?
Question 2:
Speaking of uploading, If I have three frames each with their own page,
is
Quote:
Quote:
there a predicable ONLOAD sequence of the frame/page loads? (I take it
http
can multithread this if it chooses? but not the script execution) I know
that trying to access an Applet method looks like a bit of a synch
point,
Quote:
Quote:
but a lot of what I want to do/reference in Frame B's load function is
not
Quote:
Quote:
available 'cos frame A hasn't constructed all it's objects yet. If
ONLOAD
Quote:
Quote:
happens too early for me, can I have a init() function in each frame and
then call it from the onload() event in the driving/mainline Frame? But
then
there's that timing race condition again, or is there?
I just don't want to have to re-initialize a whole lot of variables
needlessley every time a frame becomes visible/active.
Thanks for any help.
Cheers Richard Maher
>
Hi Richard,
>
Just my two cents:
>
Keep on reading about Javascript, eventually you'll find that using frames
can be a bit of a pain to handle...
Instead, think of getting rid of the frames and start learning
xmlhttprequest. (or the so popular term ajax)
>
Q1
Do not duplicate functions as this can be more trouble worth it, store all
functions in one js file and load it in the parent frame.
>
Q2
There's no predictable load. Perhaps having a timer in the main frame
checking out if a certain variable is available in it's child frames is a
way to go (and indeed using the child frame onload).
>
Consider the following, someone is using your application, filling out all
sorts of stuff, calculations are being made and stored in variables... but
then, oh horror... he/she presses F5, everything reloads... and the 'fun'
starts all over again...
>
Hope this sort of helps...
>
>
>
>