@eduardugr, the JS keyboard is created differently, try the following
my_keyboard = new core.Keyboard({psychoJS: psychoJS, clock: new util.Clock(), waitForStart: true});
If you generate some JS code using Builder, with a keyboard component, you can see how a keyboard is set up using JS code.