INNER CODE UNIT · Go

NewNavigationStack

vladimirvivien/ktop · application/navigation.go:26

func NewNavigationStack() *NavigationStack {
	return &NavigationStack{
		stack: []PageState{
			{PageType: PageOverview},
		},
	}
}

// Push adds a new page to the stack
func (n *NavigationStack) Push(state PageState) {
	n.stack = append(n.stack, state)
}

// Pop removes and returns the top page from the stack
// Returns nil if only the root page (overview) remains
func (n *NavigationStack) Pop() *PageState {
	if len(n.stack) <= 1 {
		return nil // Can't pop the root page

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…