Similar to Storage Location view (save view state to local storage) but now for the URL params!
So this lets you bind URL parameters to UI components, its even back-writable, so setting UI components will cause a disruptive top level navigation (don’t worry, it’s off by default).
In a job I am working on I need sensative credentials, so I pass them into a form
viewof creds = Inputs.text()
However, I hate typing them in so one upgrade is to bind that to local storage
viewof creds = Inputs.bind(Inputs.text(), localStorageView("creds"))
However, I then want a CI process testing the notebook periodically (see healthcheck). So for this use case the external test runner can additionally pass the creds in via a URL parameter
viewof creds = Inputs.bind(Inputs.bind(Inputs.text(), localStorageView("creds")), urlQueryFieldView("creds"))
EDIT: The last bind has a mistake, see urlQueryFieldView (rw view interface to the URL parameters) - #4 by tomlarkworthy, should be
viewof url = bindOneWay(
Inputs.bind(
Inputs.text({ label: "creds" }),
localStorageView("creds")
),
urlQueryFieldView("creds"),
{ onlyDefined: true }
)
So now creds can be set manually, or by URL params, and I have not disrupted the original notebook source at all!