app is not defined indeed. You can either use pc.app or this.app for it to work.
pc.app.keyboard.isPressed