(frame)
| 42 | } |
| 43 | |
| 44 | constructor(frame) { |
| 45 | this.startedAt = null |
| 46 | this.extraSecs = 2 |
| 47 | this.output = null |
| 48 | this.handleDeps = true |
| 49 | |
| 50 | this.callbacks = {} |
| 51 | // Used to cancel existing events when new code is loaded |
| 52 | this.timeouts = []; this.intervals = []; this.frames = [] |
| 53 | this.framePos = 0 |
| 54 | |
| 55 | // Loaded CommonJS modules |
| 56 | this.loaded = new Cached(name => resolved.compute(name).then(({name, code}) => this.evalModule(name, code))) |
| 57 | |
| 58 | this.frame = frame |
| 59 | this.win = frame.contentWindow |
| 60 | this.setupEnv() |
| 61 | |
| 62 | const resize = () => { |
| 63 | if (this.frame.style.display != "none") this.resizeFrame() |
| 64 | } |
| 65 | this.frame.addEventListener("load", resize) |
| 66 | let resizeTimeout = null |
| 67 | const scheduleResize = () => { |
| 68 | this.win.clearTimeout(resizeTimeout) |
| 69 | this.win.__setTimeout(resize, 200) |
| 70 | } |
| 71 | this.win.addEventListener("keydown", scheduleResize) |
| 72 | this.win.addEventListener("mousedown", scheduleResize) |
| 73 | } |
| 74 | |
| 75 | async run(code, output) { |
| 76 | if (output) this.output = output |
nothing calls this directly
no test coverage detected