When I access this.layout object in instance's onCreate function, it return undefined instead of the current layout. Am I missing anything?
Why would you expect it to work? That is not a property set on instances. Only the layer is set, and you can get the layout from the layer.
But I've tried using this.runtime.running_layout, it returns null instead. Is there an event to get notified when the layer is created?
Develop games in your browser. Powerful, performant & highly capable.
It depends when you check for the value and where from. Just look in Chrome's debugger to see what properties are there.