import "AssertUtils.bs" namespace MessagePortUtils function ObserveFieldScopedExSafe(node as dynamic, field as string, port as dynamic) as void #if DEBUG Assert.IsValid(node, "Node is invalid") Assert.NodeHasField(node, field, `Node does not have field "${field}"`) #end if ' ObserveFieldScopedEx was added in 12.0 if FindMemberFunction(node, "ObserveFieldScopedEx") <> invalid ' bs:disable-next-line NO_OBSERVE_FIELD_SCOPED_EX node.ObserveFieldScopedEx(field, port) else node.ObserveFieldScoped(field, port) end if end function end namespace