demo/dist/demo.js
function loadSprite(url, id) {
	  if (!is$1.string(url)) {
	    return;
	  }

	  var prefix = 'cache';
	  var hasId = is$1.string(id);
	  var isCached = false;

	  var exists = function exists() {
	    return document.getElementById(id) !== null;
	  };

	  var update = function update(container, data) {
	    container.innerHTML = data; // Check again incase of race condition

	    if (hasId && exists()) {
	      return;
	    } // Inject the SVG to the body


	    document.body.insertAdjacentElement('afterbegin', container);
	  }; // Only load once if ID set


	  if (!hasId || !exists()) {
	    var useStorage = Storage.supported; // Create container

	    var container = document.createElement('div');
	    container.setAttribute('hidden', '');

	    if (hasId) {
	      container.setAttribute('id', id);
	    } // Check in cache


	    if (useStorage) {
	      var cached = window.localStorage.getItem("".concat(prefix, "-").concat(id));
	      isCached = cached !== null;

	      if (isCached) {
	        var data = JSON.parse(cached);
	        update(container, data.content);
	      }
	    } // Get the sprite


	    fetch(url).then(function (result) {
	      if (is$1.empty(result)) {
	        return;
	      }

	      if (useStorage) {
	        window.localStorage.setItem("".concat(prefix, "-").concat(id), JSON.stringify({
	          content: result
	        }));
	      }

	      update(container, result);
	    }).catch(function () {});
	  }
	}
function loadSprite(url, id) {
	  if (!is$1.string(url)) {
	    return;
	  }

	  var prefix = 'cache';
	  var hasId = is$1.string(id);
	  var isCached = false;

	  var exists = function exists() {
	    return document.getElementById(id) !== null;
	  };

	  var update = function update(container, data) {
	    container.innerHTML = data; // Check again incase of race condition

	    if (hasId && exists()) {
	      return;
	    } // Inject the SVG to the body


	    document.body.insertAdjacentElement('afterbegin', container);
	  }; // Only load once if ID set


	  if (!hasId || !exists()) {
	    var useStorage = Storage.supported; // Create container

	    var container = document.createElement('div');
	    container.setAttribute('hidden', '');

	    if (hasId) {
	      container.setAttribute('id', id);
	    } // Check in cache


	    if (useStorage) {
	      var cached = window.localStorage.getItem("".concat(prefix, "-").concat(id));
	      isCached = cached !== null;

	      if (isCached) {
	        var data = JSON.parse(cached);
	        update(container, data.content);
	      }
	    } // Get the sprite


	    fetch(url).then(function (result) {
	      if (is$1.empty(result)) {
	        return;
	      }

	      if (useStorage) {
	        window.localStorage.setItem("".concat(prefix, "-").concat(id), JSON.stringify({
	          content: result
	        }));
	      }

	      update(container, result);
	    }).catch(function () {});
	  }
	}
function loadSprite ( url , id ) { if ( ! is$1 . string ( url ) ) { return ; } var prefix = 'cache' ; var hasId = is$1 . string ( id ) ; var isCached = false ; var exists = function exists ( ) { return document . getElementById ( id ) !== null ; } ; var update = function update ( container , data ) { container . innerHTML = data ; // Check again incase of race condition if ( hasId && exists ( ) ) { return ; } // Inject the SVG to the body document . body . insertAdjacentElement ( 'afterbegin' , container ) ; } ; // Only load once if ID set if ( ! hasId || ! exists ( ) ) { var useStorage = Storage . supported ; // Create container var container = document . createElement ( 'div' ) ; container . setAttribute ( 'hidden' , '' ) ; if ( hasId ) { container . setAttribute ( 'id' , id ) ; } // Check in cache if ( useStorage ) { var cached = window . localStorage . getItem ( "" . concat ( prefix , "-" ) . concat ( id ) ) ; isCached = cached !== null ; if ( isCached ) { var data = JSON . parse ( cached ) ; update ( container , data . content ) ; } } // Get the sprite fetch ( url ) . then ( function ( result ) { if ( is$1 . empty ( result ) ) { return ; } if ( useStorage ) { window . localStorage . setItem ( "" . concat ( prefix , "-" ) . concat ( id ) , JSON . stringify ( { content : result } ) ) ; } update ( container , result ) ; } ) . catch ( function ( ) { } ) ; } }
==========================================================================
==========================================================================