Workaround to post inline JS code at any time in D8?
Sometimes the $form is not accessible and  I'd like to invoke some JS code on certain functions and conditions for debugging purposes.

Not sure if this will do for you, but posting this anyways just in case.
I use Greasemonkey for Firefox and Tampermonkey for Chrome which allows your browser to load any js file that you write locally on this app/your computer.