Department of Physics and Astronomy

The Forbes Group

Javascript

$\newcommand{\vect}[1]{\mathbf{#1}} \newcommand{\uvect}[1]{\hat{#1}} \newcommand{\abs}[1]{\lvert#1\rvert} \newcommand{\norm}[1]{\lVert#1\rVert} \newcommand{\I}{\mathrm{i}} \newcommand{\ket}[1]{\left|#1\right\rangle} \newcommand{\bra}[1]{\left\langle#1\right|} \newcommand{\braket}[1]{\langle#1\rangle} \newcommand{\op}[1]{\mathbf{#1}} \newcommand{\mat}[1]{\mathbf{#1}} \newcommand{\d}{\mathrm{d}} \newcommand{\pdiff}[3][]{\frac{\partial^{#1} #2}{\partial {#3}^{#1}}} \newcommand{\diff}[3][]{\frac{\d^{#1} #2}{\d {#3}^{#1}}} \newcommand{\ddiff}[3][]{\frac{\delta^{#1} #2}{\delta {#3}^{#1}}} \DeclareMathOperator{\erf}{erf} \DeclareMathOperator{\Tr}{Tr} \DeclareMathOperator{\order}{O} \DeclareMathOperator{\diag}{diag} \DeclareMathOperator{\sgn}{sgn} \DeclareMathOperator{\sech}{sech} $

JavaScript

This post discusses JavaScript.

Single-Page Applications (SPAs)

Many JavaScript applications require running a server to host parts of the application. A pervasive example are web-pages that use the popular Node.js framework. These require that the node server is running somewhere to serve the page – either on a web-server which is hosting the pages, or on the client's machine if functioning as a stand-alone application.

This means someone must start the node server, either placing a burden on the client (who must now install Node.js and start the server) or preventing the page from being hosted on a static site.

The alternative is to provide the entire JavaScript application through a static web-page and have everything running on the client's web browser. This latter approach is called a single-page application (SPA).

In [ ]: