MCPcopy Create free account
hub / github.com/scriptscat/scriptcat / compileInjectScriptByFlag

Function compileInjectScriptByFlag

src/app/service/content/utils.ts:179–186  ·  view source on GitHub ↗
(
  flag: string,
  scriptCode: string,
  autoDeleteMountFunction: boolean = false
)

Source from the content-addressed store, hash-verified

177}
178
179export function compileInjectScriptByFlag(
180 flag: string,
181 scriptCode: string,
182 autoDeleteMountFunction: boolean = false
183): string {
184 const autoDeleteMountCode = autoDeleteMountFunction ? `try{delete window['${flag}']}catch(e){}` : "";
185 return `window['${flag}'] = function(){${autoDeleteMountCode}${scriptCode}}`;
186}
187
188/**
189 * 脚本加载信息。(Inject/Content环境用,避免过多不必要信息公开,减少页面加载信息存储量)

Callers 2

compileInjectScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected