mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-06 00:14:13 +00:00
add new history record on request changed only
This commit is contained in:
parent
d3d6e859f0
commit
b00e5befde
@ -95,8 +95,16 @@ impl Page {
|
|||||||
&request, true, // activate (page reload)
|
&request, true, // activate (page reload)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add new history record on request change
|
||||||
|
match navigation.history_current() {
|
||||||
|
Some(current) => {
|
||||||
|
if current != request {
|
||||||
navigation.history_add(request);
|
navigation.history_add(request);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
None => navigation.history_add(request),
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Return activated structure
|
// Return activated structure
|
||||||
|
@ -93,6 +93,10 @@ impl Navigation {
|
|||||||
self.history.back(follow_to_index)
|
self.history.back(follow_to_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn history_current(&self) -> Option<GString> {
|
||||||
|
self.history.current()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn history_forward(&self, follow_to_index: bool) -> Option<GString> {
|
pub fn history_forward(&self, follow_to_index: bool) -> Option<GString> {
|
||||||
self.history.forward(follow_to_index)
|
self.history.forward(follow_to_index)
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,16 @@ impl History {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn current(&self) -> Option<GString> {
|
||||||
|
let index = self.index.borrow().clone(); // keep outside as borrow
|
||||||
|
if let Some(usize) = index {
|
||||||
|
if let Some(memory) = self.memory.borrow().get(usize) {
|
||||||
|
return Some(memory.request.clone());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
pub fn forward(&self, follow_to_index: bool) -> Option<GString> {
|
pub fn forward(&self, follow_to_index: bool) -> Option<GString> {
|
||||||
let index = self.index.borrow().clone(); // keep outside as borrow
|
let index = self.index.borrow().clone(); // keep outside as borrow
|
||||||
if let Some(usize) = index {
|
if let Some(usize) = index {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user