0

I would like to listen to the event emitted when a surface is created. The purpose is then to load a google map inside the div contained in this surface.

var surfaceMap = new Surface({
  size: [400, 400],
  content: '<div id="maps"/>'
});

surfaceMap.on('**event_to_listen_to**', function() {
  //My code goes there
});

But the documentation does not list such event. Does anyone have an idea? Or maybe propose a better alternative to achieve this goal?

Thanks!

eckm
  • 3
  • 1

1 Answers1

1

Yes, there is the deploy event that fires when the surface is rendered to the screen..

surface.on('deploy',function(){
    // do something
});

This event demonstrates the power of requestAnimationFrame, and how cycles are not used if a window is hidden by another tab. If you reload your code while the window is not visible, the deploy function will not be called until window becomes visible again.

Hope this helps!

johntraver
  • 3,612
  • 18
  • 17