@@ -205,6 +205,24 @@ function addReceivers(ports) {
205205 if (v.length > 0) window.location = v;
206206 });
207207 }
208+ if ('favicon' in ports) {
209+ if (typeof ports.favicon === 'string') {
210+ changeFavicon(ports.favicon);
211+ } else {
212+ ports.favicon.subscribe(changeFavicon);
213+ }
214+ }
215+ function changeFavicon(src) {
216+ var link = document.createElement('link');
217+ var oldLink = document.getElementById('elm-favicon');
218+ link.id = 'elm-favicon';
219+ link.rel = 'shortcut icon';
220+ link.href = src;
221+ if (oldLink) {
222+ document.head.removeChild(oldLink);
223+ }
224+ document.head.appendChild(link);
225+ }
208226}
209227
210228function initGraphics(elm, Module) {