on master help sign in
Allow the title port to work on Strings and Signals of Strings
commit1650aad82929d5599ff744487b717901fa31e424 authorEvan Czaplicki <info@elm-lang.org> dateMon 13 Jan 2014, 21:12 (13 years ago) parent32fbbca
1 file changed+5−1
runtime/Init.js+5−1
runtime/Init.js+5−1
@@ -189,7 +189,11 @@ function addReceivers(ports) {
189189 ports.stderr.subscribe(handler);
190190 }
191191 if ('title' in ports) {
192− ports.title.subscribe(function(v) { document.title = v; });
192+ if (typeof ports.title === 'string') {
193+ document.title = ports.title;
194+ } else {
195+ ports.title.subscribe(function(v) { document.title = v; });
196+ }
193197 }
194198 if ('redirect' in ports) {
195199 ports.redirect.subscribe(function(v) {