Adapt binding.resize for Shiny contexts

This relies on shiny's `feature/output-resize` branch. However, if an older version of Shiny is used, everything should work except for the resize callbacks in Shiny contexts.