How about using Local storage to store application states. I am not sure if
it wont kill the app to free the resources. But I would still love to see
the results of using local storage instead of session storage.

*Prateek Jadhwani*
www.prateekjadhwani.com


On Thu, Mar 27, 2014 at 11:33 AM, Thinker K.F. Li <[email protected]>wrote:

> The problem of low-memory devices of B2G is killing apps very often to
> release memory for the foreground app.  It makes background apps lost
> their context, and being restarted for next launch.  The problem is user
> would like to keep the states of apps when they revisit the app next
> time.  So, we need a way to restore the states of apps being killed.
>
> One of ideas is to leverage the unload event and the sessionStorage
> API.  Before the app process was killed, an unload event would be
> dispatched to the document.  The app save its state on the
> sessionStorage in the event handler, so it could be restored for next
> time of launching.
>
> When a process is being killed, the content process tries to dispatch an
> unload event to the document.  If the document handles the event, the
> B2G assume it is session aware, and will save the states, and restore
> itself next time.  So, if the unload event is handled, the content of
> sessionStorage and cookie are sent to the b2g process before the process
> being dead.  Next time, the user revisit the app, the sessionStorage and
> cookie are restored from the data at the b2g process.  The app could
> restore it's state from the data in the sessionStorage and cookie.
>
> For best side of this approach is that we could keep the app being
> killed in the card view, and restore it to the state before being killed
> while the user revisit it next time.  It provides better experience to
> the user.
>
> The problem is, I know, we are unlikely to encourage people to use
> sessionStorage or cookie as a synchronize API.  Is there any other
> option?
>
> Please give me feedbacks.
>
> --
> Sinker
> --
> 天教懶漫帶疏狂
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to