Proper way to enqueue a generated script that isn’t in a .js file?

I ended up using wp_localize_script(). This allowed me just to send the PHP variables as parameters directly to a javascript file. Also useful for doing translations in javascript files. And then I didn’t have to do messy inline javascript.