function defineProperty(obj, name, opt_kind, opt_setHook) {
    if (typeof obj == 'function') obj = obj.prototype;

    let kind = opt_kind || PropertyKind.JS;

    if (!obj.__lookupGetter__(name))
      obj.__defineGetter__(name, getGetter(name, kind));

    if (!obj.__lookupSetter__(name))
      obj.__defineSetter__(name, getSetter(name, kind, opt_setHook));
  }
Defines a property on an object. When the setter changes the value a
property change event with the type {@code name + 'Change'} is fired.
@param {!Object} obj The object to define the property for.
@param {string} name The name of the property.
@param {cr.PropertyKind=} opt_kind What kind of underlying storage to use.
@param {function(*):void} opt_setHook A function to run after the
    property is set, but before the propertyChange event is fired.