fix some examples that used the private API
This commit is contained in:
1 parent
2d51a1c4f2
commit
20296b5038
2 files changed
+12
-25
No files matched your search
@@ -217,23 +217,16 @@ fn create_random_dynamic_attr(cx: &ScopeState) -> Attribute {
|
|||||||
5 => AttributeValue::None,
|
5 => AttributeValue::None,
|
||||||
6 => {
|
6 => {
|
||||||
let value = cx.listener(|e: Event<String>| println!("{:?}", e));
|
let value = cx.listener(|e: Event<String>| println!("{:?}", e));
|
||||||
return Attribute {
|
return Attribute::new("ondata", value, None, false);
|
||||||
name: "ondata",
|
|
||||||
value,
|
|
||||||
namespace: None,
|
|
||||||
mounted_element: Default::default(),
|
|
||||||
volatile: false,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
Attribute {
|
Attribute::new(
|
||||||
name: Box::leak(format!("attr{}", rand::random::<usize>()).into_boxed_str()),
|
Box::leak(format!("attr{}", rand::random::<usize>()).into_boxed_str()),
|
||||||
value,
|
value,
|
||||||
namespace: random_ns(),
|
random_ns(),
|
||||||
mounted_element: Default::default(),
|
rand::random(),
|
||||||
volatile: rand::random(),
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut TEMPLATE_COUNT: usize = 0;
|
static mut TEMPLATE_COUNT: usize = 0;
|
||||||
@@ -288,12 +281,9 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
|
|||||||
let dynamic_nodes: Vec<_> = dynamic_node_types
|
let dynamic_nodes: Vec<_> = dynamic_node_types
|
||||||
.iter()
|
.iter()
|
||||||
.map(|ty| match ty {
|
.map(|ty| match ty {
|
||||||
DynamicNodeType::Text => DynamicNode::Text(VText {
|
DynamicNodeType::Text => DynamicNode::Text(VText::new(Box::leak(
|
||||||
value: Box::leak(
|
format!("{}", rand::random::<usize>()).into_boxed_str(),
|
||||||
format!("{}", rand::random::<usize>()).into_boxed_str(),
|
))),
|
||||||
),
|
|
||||||
id: Default::default(),
|
|
||||||
}),
|
|
||||||
DynamicNodeType::Other => {
|
DynamicNodeType::Other => {
|
||||||
create_random_dynamic_node(cx, cx.props.depth + 1)
|
create_random_dynamic_node(cx, cx.props.depth + 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,12 +262,9 @@ fn create_random_element(cx: Scope<DepthProps>) -> Element {
|
|||||||
let dynamic_nodes: Vec<_> = dynamic_node_types
|
let dynamic_nodes: Vec<_> = dynamic_node_types
|
||||||
.iter()
|
.iter()
|
||||||
.map(|ty| match ty {
|
.map(|ty| match ty {
|
||||||
DynamicNodeType::Text => DynamicNode::Text(VText {
|
DynamicNodeType::Text => DynamicNode::Text(VText::new(Box::leak(
|
||||||
value: Box::leak(
|
format!("{}", rand::random::<usize>()).into_boxed_str(),
|
||||||
format!("{}", rand::random::<usize>()).into_boxed_str(),
|
))),
|
||||||
),
|
|
||||||
id: Default::default(),
|
|
||||||
}),
|
|
||||||
DynamicNodeType::Other => {
|
DynamicNodeType::Other => {
|
||||||
create_random_dynamic_node(cx, cx.props.depth + 1)
|
create_random_dynamic_node(cx, cx.props.depth + 1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user