Sunday 10 January 2010

AJAX in Python? The Answer is Pyjamas.

First Concepts

First, INLINE FRAMES. An INLINE frame is "used to EMBED a document within the current HTML document" (quote: w3schools). The syntax is: "OPEN TAG iframe S R C equals U R L CLOSE TAG". The syntax is SIMPLE. That's inline frames 101.

Secret: It's all done with inline frames

Big assumption, but let's you have written your FIRST PYJAMAS PROGRAM. You have INVOKED the pyjs compiler using BUILD-DOT-ESS-AITCH (./build.sh). A new web page is BORN. How does it work? Simple - your fancy html page simply calls bootstrap, which has a function that calls injectWebModeFrame. This loads up a nocache.html file (a generic cache file) which then in turn location.replaces itself (Harry Houdini style) with the browser-specific cache file (named using navigator.useragent). To understand how your engine is working, you need to read the source of the browser-specific cache file.

Attacking the Mozilla
Open up the mozilla (firefox) file and you will see a sea of JS variables prefixed with $, such as var $wnd = parent. This is the style in which JS is now programmed. Have Venkman on hand to debug anything vaguely Gecko-related.

Aggrandising Your Intelligence
Read this book written by Luke.

No comments: