on master help sign in
Allow the title port to work on Strings and Signals of Strings
1650aadEvan Czaplicki
runtime/Init.js+5−1
@@ -189,7 +189,11 @@ function addReceivers(ports) {
189 ports.stderr.subscribe(handler);
189 ports.stderr.subscribe(handler);
190 }
190 }
191 if ('title' in ports) {
191 if ('title' in ports) {
192+ if (typeof ports.title === 'string') {
193+ document.title = ports.title;
194+ } else {
192− ports.title.subscribe(function(v) { document.title = v; });
195+ ports.title.subscribe(function(v) { document.title = v; });
196+ }
193 }
197 }
194 if ('redirect' in ports) {
198 if ('redirect' in ports) {
195 ports.redirect.subscribe(function(v) {
199 ports.redirect.subscribe(function(v) {