working on a game engine currently that wraps opengl's output and sdl's input, exposes it to javascript along with helper functions for OS interaction. you can run js at runtime or initialization time, or reload files entirely
shame its not public, but the idea is really simple and you can implement this with a bit of elbow grease
I think it is already what Unity or Unreal do, OpenGL on Ps4, SDL inputs are just a bunch of OS bindings, and you can use Lua/Python scripts to modify you entities (doing some custom mods to the engine).
yeah essentially, unity and unreal have alot more complexity than mine though. my idea is just to have a JS interpreter, SDL window and the rest is exposed to JS (besides the lower level/intensive work).
I just wanted a cleaner Ecmascript 5/6 system that was expandable, didn't find that as possible with unity (atleast not without jumping through aload of hoops). The scripts dont only modify entities though they can interact with the SDL/GL bindings directly, so its not as limited to just what the engine supports