Skip to content

Custom Key Detection

madprops edited this page Aug 1, 2017 · 2 revisions

If you want to have a more customized key detection system when Escape is pressed.

var msg = Msg(
{
	// Any other option you want
	close_on_escape: false
});

// Make a function to handle keyboard input

document.addEventListener('keyup', function(e)
{
	if(e.keyCode === 27)
	{
		// Do whatever you want
		// msg.is_open() or msg.is_highest() can be useful
	}
});
Clone this wiki locally