Can we just do this with window.innerWidth and window.innerHeight instead?  matchMedia() seems pretty heavyweight to use here.

var minDimension = Math.min(window.innerWidth, window.innerHeight);
if (minDimension >= 540) {
  // 180px
}
else if (minDimension >= 480) {
  // 160px
}

Would that work?