The short answer is that you cannot.
In a future version of SAFENetwork, compute will be offered, perhaps allowing scripts to be run by the network on behalf of the user too. This would allow more powerful apps to be created.
SAFENetwork requires a different approach to writing web apps. It is more powerful in some ways and less so in others. The latter will likely be improved in subsequent SAFENetwork versions.