Upgrading from Earlier Version

Wax has changed – it’s now at version 6. The API was the same from version 4 to 5 – though they had an upgrade in the Modest Maps dependency.

It changes at 6. Here’s a rundown:

Interaction

Interaction and tooltip functionality is more flexible. While tooltips used to:

wax.mm.interaction(map, tilejson);

It is now:

wax.mm.interaction().map(map).tilejson(tilejson)
    .on(wax.tooltip().parent(map.parent).events());

More code, but for a good reason: it’s much more flexible. If your map layers change, and you have a new TileJSON object that describes how their interaction works, you can simply call

existingInteractionObject.tilejson(newTileJson);

And the same with .map(). The tooltip API is also much more powerful and accessible – see the page on tooltips for more details.

Modest Maps 1

Wax v6 is compatible with, and embraces the first major release of Modest Maps. The big change in the new version is that Modest Maps now supports multiple layers. For the most part, you can use it just like before, but one common thing that you do with a map is replacing the main layer – and that has changed.

Previously,

map.setProvider(new wax.mm.connector(tilejson));

Is now

map.setLayerAt(0, new wax.mm.connector(tilejson));

There’s lots more documentation on the new Layers Interface in the Modest Maps Wiki and also a page on upgrading to 1.0.0 that covers other, smaller changes.