function dispose(obj) {
  if (obj && typeof obj.dispose == 'function') {
    obj.dispose();
  }
}
Calls `dispose` on the argument if it supports it. If obj is not an
    object with a dispose() method, this is a no-op.
@param {*} obj The object to dispose of.