HTML5 Canvas Canvas Multi-Event Binding Tutorial

To bind multiple events to a single handler with Konva, we can use the on() method and pass in a space delimited string containing multiple event types.

Instructions: Mouseover, mousedown, and mouseup over the circle to observe that the function bound to the circle is executed for each event.

Konva Multi_Event Demoview raw
<!DOCTYPE html>
<script src=""></script>
<meta charset="utf-8">
<title>Konva Multi-Event Binding Demo</title>
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #F0F0F0;
<div id="container"></div>
function writeMessage(message) {
var stage = new Konva.Stage({
container: 'container',
width: 300,
height: 300
var layer = new Konva.Layer();
var text = new Konva.Text({
x: 10,
y: 10,
fontFamily: 'Calibri',
fontSize: 20,
text: '',
fill: 'black'
var numEvents = 0;
var circle = new Konva.Circle({
x: stage.getWidth() / 2,
y: stage.getHeight() / 2 + 10,
radius: 70,
fill: 'red',
stroke: 'black',
strokeWidth: 4
circle.on('mouseover mousedown mouseup', function() {
writeMessage('Multi-event binding! Events: ' + (++numEvents));
circle.on('mouseout', function() {
// add the layer to the stage