Skip to content
This repository
Newer
Older
100644 34 lines (26 sloc) 1.076 kb
5cf14fa2 » lkcl
2009-08-17 add kees jsimport example... as an example :)
1 # WARNING: the use of javascript pretty much trashes all chance of using
2 # pyjamas-desktop. give serious consideration to doing something OTHER
3 # than including random bits of javascript off the internet in a pyjamas
4 # application. the larger the random bit of javascript, the more chance
5 # there is that it will interact in some horrendous way with the pyjamas
6 # infrastructure.
7 #
8 # if you ABSOLUTELY MUST use javascript, here's how to do it.
9 #
10
11 from pyjamas import log
12
13 # this simply tells the compiler that the two names are to be dropped
14 # into the javascript global namespace
15 from __javascript__ import examplevar, get_examplevar
16
17 # the default behaviour of jsimport is to include the javascript file
18 # "inline" - unmodified - direct into the compiler output
19 from __pyjamas__ import jsimport
20
21 jsimport("example.js")
22
f53f8da4 » keesbos
2011-04-18 Got jsimport working, though with slightly different
23 def main():
2612033d » pakal
2011-11-22 Misc bugfixes in error reporting and build systems.
24 global examplevar
25 #examplevar is actually "out of modules", in a super scope
26
f53f8da4 » keesbos
2011-04-18 Got jsimport working, though with slightly different
27 log.writebr(examplevar)
28 examplevar = 'Altered'
2612033d » pakal
2011-11-22 Misc bugfixes in error reporting and build systems.
29 log.writebr(get_examplevar())
5cf14fa2 » lkcl
2009-08-17 add kees jsimport example... as an example :)
30
f53f8da4 » keesbos
2011-04-18 Got jsimport working, though with slightly different
31 main()
2612033d » pakal
2011-11-22 Misc bugfixes in error reporting and build systems.
32
33 examplevar = "Realtered"
34 log.writebr(get_examplevar())
Something went wrong with that request. Please try again.