You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

imp.js 959B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. window.iglob = window.iglob || {gcs:[]}
  2. var com = ``
  3. com = `
  4. function impm(filename){
  5. var gcs = iglob.gcs
  6. (async () => {
  7. let sv = {}
  8. const src = filename
  9. // const src = chrome.extension.getURL(filename);
  10. const contentScript = await import(src);
  11. sv.filename=filename
  12. sv.src=src
  13. sv.contentScript=contentScript
  14. gcs.push(sv)
  15. contentScript.einit()
  16. })();
  17. }
  18. `
  19. function rej_imp(){
  20. clog("rej_imp!")
  21. }
  22. function res_imp(){
  23. clog("res_imp!")
  24. }
  25. function impm(filename){
  26. var gcs = iglob.gcs
  27. const src = filename
  28. // import(`src`).then(res_imp).catch(rej_imp)
  29. // import(`./imp2`).then(res_imp).catch(rej_imp)
  30. // import(`${src}`).then(res_imp).catch(rej_imp)
  31. /*
  32. (async () => {
  33. let sv = {}
  34. // const src = chrome.extension.getURL(filename);
  35. const contentScript = await import(src);
  36. sv.filename=filename
  37. sv.src=src
  38. sv.contentScript=contentScript
  39. gcs.push(sv)
  40. contentScript.einit()
  41. })();
  42. */
  43. }
  44. iglob.impm = impm