I am trying to create a singleton object in Amber like smalltalk. My
code just returns <FB> which gets defined upon loading the Facebook
Javascript API. The problem seems to be timing. I get an error message
the JSObjectProxy doesn't understand "example", but by the time I
inspect the object its there !
The tag that loads the API is:
<script src="
http://connect.facebook.net/en_US/all.js"></script>
then later in the html I have:
<script type="text/javascript">
loadAmber({
files: ['FBook.js'],
prefix: 'projects/fbook/js',
ready: function() {
smalltalk.FBook._example();
}});
</script>
So should I use a callback for when the FB API is finished loading ?
If so, is it possible to put it on the Amber side using a Block ?
Sorry for being dense. I'm slowly getting it but the Amber to JS bit
still has me confused. I have looked at the source for Amber and it
looks like #smalltalk gets defined in some CodeMirror stuff which is
not clear to me.