Every line of 'addition function in javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
7 function addJavascript(jsname, pos) { 8 9 var th = document.getElementsByTagName(pos)[0]; 10 var s = document.createElement('script'); 11 s.setAttribute('type', 'text/javascript'); 12 s.setAttribute('src', jsname); 13 th.appendChild(s); 14 15 };
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
28 function addCodeToFunction(func,code){ 29 if(func == undefined) 30 return code; 31 else{ 32 return function(){ 33 func(); 34 code(); 35 } 36 } 37 }
65 function addClosure(jsTpl) { 66 var conf = this.conf; 67 return '' 68 + '(function(root){' 69 + 'var __ret={' 70 + 'render:function(__tn, __da){' 71 + 'if(typeof __tn=="object"){__da=__tn;__tn=undefined;}' 72 + 'if(typeof __tn=="string"){__da=__da||{};}' + jsTpl 73 + '}' 74 + '};\n' 75 + (conf.isCmd 76 ? 'if (typeof exports=="object" && typeof module=="object"){exports=module.exports=__ret;}\n' 77 : '') 78 + (conf.isAmd 79 ? 'if (typeof define=="function" && define.amd){define(__ret);}\n' 80 : '') 81 + 'root.' + (conf.globalVar || '_smartyTpl') + '=__ret;\n' 82 + 'return __ret;' 83 + '})(this);'; 84 }
204 function addJavascript(filename){ 205 var fileref=document.createElement('script') 206 fileref.setAttribute("src", "/scripts/" + filename) 207 fileref.setAttribute("type","text/javascript") 208 document.head.appendChild(fileref); 209 }
56 function addFunction(func, key) { 57 return { 58 type: actionTypes.APP_PUSH_OFFLINE_QUEUE, 59 payload: { 60 func, 61 key 62 } 63 } 64 }