Monitoring whether a window size changes in js

Mar 19, 2013 at 6:06am

Monitoring whether a window size changes in js

Hi, is there a callback mechanism for this so that it’s possible to tell when windows have been resized, closes etc?

thx Lee

Mar 19, 2013 at 1:08pm

you need to create a repeating task.

// 11oLsen, report changed window size

outlets = 2;
var	nowsize;
var lastsize;

var pollTsk = new Task(getsize, this);

function on()
	lastsize = -1;

	pollTsk.interval = 10; //set interval of polling in ms 


function off()

function getsize()

	nowsize = this.patcher.wind.size;
	if (nowsize[0] != lastsize[0] || nowsize[1] != lastsize[1]) {
		lastsize = nowsize;



btw: there’s a windowwatcher external in the sdk ready to compile, don’t ask me why they don’t add this to the standard object set..

Mar 19, 2013 at 1:31pm

excellent, thanks for the help :)


You must be logged in to reply to this topic.