Is it possible to return WASM from the Worker, instead of executing it?

I would like to return WebAssembly code from the worker, instead of executing it. I need this because, I would like to have access to the Window API, and that’s not possible if the code is executed in the cloud. The code is very simple right now:

pub fn main() {
    let window = web_sys::window();
    let navigator = web_sys::navigator();
    let do_not_track = navigator.do_not_track();

I’ve tried to return the wasm variable, but of course, that didn’t work.