private static JavaScriptValue ShouldDeprioritizeSubtree( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithType(1, nameof(ShouldDeprioritizeSubtree), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(2, nameof(ShouldDeprioritizeSubtree), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } try { var type = arguments[1].ToString(); var props = ComponentMapper.CreateProps(type, arguments[2]); var result = ShouldDeprioritizeSubtree(type, props); return(JavaScriptValue.FromBoolean(result)); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }
private static JavaScriptValue PrepareUpdate( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithExternalData <VisualElement>(1, nameof(PrepareUpdate))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(2, nameof(PrepareUpdate), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(3, nameof(PrepareUpdate), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(4, nameof(PrepareUpdate), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithExternalData <VisualElement>(5, nameof(PrepareUpdate))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithExternalData <HostContext>(6, nameof(PrepareUpdate))) { return(JavaScriptValue.Undefined); } try { var instance = arguments[1].ObjectFromJavaScriptValue <VisualElement>(); var type = arguments[2].ToString(); var oldProps = ComponentMapper.CreateProps(type, arguments[3]); var newProps = ComponentMapper.CreateProps(type, arguments[4]); var rootContainer = arguments[5].ObjectFromJavaScriptValue <VisualElement>(); var hostContext = arguments[6].ObjectFromJavaScriptValue <HostContext>(); var props = PrepareUpdate(instance, type, oldProps, newProps, rootContainer, hostContext); return(props.ToJavaScriptValue()); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }
private static JavaScriptValue CommitUpdate( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithExternalData <VisualElement>(1, nameof(CommitUpdate))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithExternalData <IComponentProps>(2, nameof(CommitUpdate))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(3, nameof(CommitUpdate), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(4, nameof(CommitUpdate), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(5, nameof(CommitUpdate), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } try { var instance = arguments[1].ObjectFromJavaScriptValue <VisualElement>(); var type = arguments[3].ToString(); var updatePayload = arguments[2].ObjectFromJavaScriptValue <IComponentProps>(); var oldProps = ComponentMapper.CreateProps(type, arguments[4]); var newProps = ComponentMapper.CreateProps(type, arguments[5]); var result = CommitUpdate(instance, updatePayload, type, oldProps, newProps); return(JavaScriptValue.FromBoolean(result)); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }
private static JavaScriptValue CommitMount( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithExternalData <VisualElement>(1, nameof(CommitMount))) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(2, nameof(CommitMount), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(3, nameof(CommitMount), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } try { var visualElement = arguments[1].ObjectFromJavaScriptValue <VisualElement>(); var type = arguments[2].ToString(); var props = ComponentMapper.CreateProps(type, arguments[3]); CommitMount(visualElement, type, props); return(JavaScriptValue.Undefined); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }
private static JavaScriptValue CreateInstance( JavaScriptValue callee, bool isconstructcall, JavaScriptValue[] arguments, ushort argumentcount, IntPtr callbackdata) { if (!arguments.ValidateWithType(1, nameof(CreateInstance), JavaScriptValueType.String)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithType(2, nameof(CreateInstance), JavaScriptValueType.Object)) { return(JavaScriptValue.Undefined); } if (!arguments.ValidateWithExternalData <VisualElement>(3, nameof(CreateInstance))) { return(JavaScriptValue.Undefined); } try { var type = arguments[1].ToString(); var props = ComponentMapper.CreateProps(type, arguments[2]); var rootContainer = arguments[3].ObjectFromJavaScriptValue <VisualElement>(); var result = CreateInstance(type, props, rootContainer); return(result.ToJavaScriptValue()); } catch (Exception ex) { Debug.LogError(ex); return(JavaScriptValue.Undefined); } }