[SailfishDevel] Remove all pages from stack before specified page

Oleg Linkin maledictusdemagog at gmail.com
Sat Sep 10 04:42:28 UTC 2016


Hello, developers

To prevent infinite page stack depth I want to cut some first pages from stack. 
I have 5 pages in stack and when I click on item and begin pushing 6 page to stack I want to remove first 4 pages and as result I want to have only 5 and 6 page in stack.
But I can't do this.

I tried the next:
                if (pageStack.depth === 5) {
                    pageStack.replaceAbove(null, pageStack.find(function(page)
                                { return /page/._depth === 4 }), {},
                            PageStackAction.Immediate)
                }

But in this case I got empty page which I found in find function

and the next:
                if (pageStack.depth === 5) {
                    pageStack.pop(pageStack.find(function(page)
                                { return /page/._depth === 4 }),
                            PageStackAction.Immediate)
                }
Documentation says:  "If a /page/ object is specified, all pages above the specified page are removed;" but in result it remove only page which found in pageStack.find function

How I can do this? Thx!

-- 
*Sincerely, Oleg Linkin.*


*Jabber: magog at gentoo.ru <magog at gentoo.ru> Skype: lord_baskervil Тел.: +375-(29)-5539994*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20160910/0caea9da/attachment.html>


More information about the Devel mailing list