diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/urweb.js | 9 | ||||
-rw-r--r-- | lib/ur/basis.urs | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 5846863a..35023924 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1824,5 +1824,14 @@ function fresh() { return "uw" + (--nextId); } +function giveFocus(id) { + var node = document.getElementById(id); + + if (node) + node.focus(); + else + er("Tried to give focus to ID not used in document: " + id); +} + // App-specific code diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index cd38c783..7f254a2f 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -762,6 +762,7 @@ val redirect : t ::: Type -> url -> transaction t type id val fresh : transaction id +val giveFocus : id -> transaction unit val dyn : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> [ctx ~ [Dyn]] => unit -> tag [Signal = signal (xml ([Dyn] ++ ctx) use bind)] ([Dyn] ++ ctx) [] use bind |