Skip to content

Commit

Permalink
added little demo page
Browse files Browse the repository at this point in the history
demonstrating how the callback mechanism works using window.caller which
gives us a configurable this-pointer. This isn't as good as a closure,
unfortunately, but it has to do.
  • Loading branch information
pilif committed May 30, 2011
1 parent a13f15f commit ba2468f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,2 +1,3 @@
sign.properties
store.jks
demo/*.jar
39 changes: 39 additions & 0 deletions demo/index.html
@@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<title>Digging out graves</title>
<style>
#grave{
position: absolute;
left: -999px;
top: -999px;
}
</style>
</head>
<body>
<applet
codebase="."
id="grave"
code="ch.gnegg.Zombie"
width="1"
height="1"
archive="grave.jar"
MAYSCRIPT
></applet>
<script>
window.caller = function(arg, cb){
cb.apply(arg);
};
$(window).load(function(){
var grave = $('#grave')[0];
var gnegg = { foo: "foobar" }
grave.logToConsole("gnegg");
grave.callbackTest(gnegg, function(){
console.log('gnewgg');
console.log(this);
});
})
</script>
</body>
</html>

0 comments on commit ba2468f

Please sign in to comment.