MCPcopy Index your code
hub / github.com/SmartTokenLabs/TokenScript / insertScript

Method insertScript

bootstrap-js/tokenscript-bootstrap.js:808–834  ·  view source on GitHub ↗
(doc, inline, src, callback)

Source from the content-addressed store, hash-verified

806 }
807
808 insertScript(doc, inline, src, callback) {
809 var s = doc.createElement("script");
810 var head = doc.querySelector('head');
811 s.type = "text/javascript";
812 if(callback) {
813 if (s.readyState){ //IE
814 s.onreadystatechange = function(){
815 if (s.readyState == "loaded" ||
816 s.readyState == "complete"){
817 s.onreadystatechange = null;
818 callback();
819 }
820 };
821 } else { //Others
822 s.onload = function(){
823 callback();
824 };
825 }
826 }
827 if (src){
828 s.src = src;
829 }
830 if (inline){
831 s.appendChild(doc.createTextNode(inline));
832 head.appendChild(s);
833 }
834 }
835
836 /*
837 inject it inside iframe to extend "web3" with property "tokens"

Callers 1

renderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected