* Run the function after all currently waiting sync scripts have been * executed. * @param {!Window} win * @param {function()} fn
(win, fn)
| 118 | * @param {function()} fn |
| 119 | */ |
| 120 | function executeAfterWriteScript(win, fn) { |
| 121 | const index = syncScriptLoads++; |
| 122 | win['__runScript' + index] = fn; |
| 123 | // eslint-disable-next-line no-useless-concat |
| 124 | win.document.write('<' + 'script>__runScript' + index + '()<' + '/script>'); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Throws if the given src doesn't start with prefix(es). |