/// <summary> /// Set the bean to the specified value. /// </summary> /// <param name="exObj"></param> /// <returns></returns> public bool SetBean(JsExternalObject exObj) { if (exObj == null) { throw new ArgumentNullException(nameof(exObj)); } if (Type != JsValueType.Object) { throw new InvalidOperationException("Beans can only be set on true objects."); } if (HasBean) { throw new InvalidOperationException("A bean has already been set for this object. Once set, beans are immutable."); } var descriptor = ValueFactory.CreateObject(); descriptor.SetProperty("value", exObj); return(Context.Object.DefineProperty(this, Context.Symbol.For(BaristaBeanName), descriptor)); }
public JsObject CreateObject() { return(ValueFactory.CreateObject()); }