Changing favicon with notebook extension

New to notebook extensions and most all web development concepts here. I’m attempting to change JupyterLab’s favicon using this cookiecutter theme, with the ultimate goal of being able to change the favicon based on a config file. I’m using a slight modification of this SOF post, included within my src/index.ts file.

let head = document.head || document.getElementsByTagName('head')[0];

function changeFavicon(src: string) {
  let link = document.createElement('link'),
       oldLink = document.getElementById('dynamic-favicon');
  link.id = 'dynamic-favicon';
  link.rel = 'icon';
  link.type = 'image/x-icon';
  link.href = src;
  if (oldLink) {
    head.removeChild(oldLink);
  }
  head.appendChild(link);
}

When I call…

changeFavicon('http://www.google.com/favicon.ico');

…the favicon changes appropriately. But how would I access a favicon.ico file stored within my very own local extension directory?

A step further, how could I change the path to different favicon files using a config file?

Thanks for the snippet! As per how to make my own extension with static files listed - this is a good example https://gitter.im/jupyterlab/jupyterlab?at=5b3b80d133b0282df4fc6df0.