The JS API consists of a single global object,
Maze, which works as the global
L in Leaflet. For example,
Maze.LayerGroup, and so on. Make sure to
check the API reference for Leaflet 1.0.0.
Also embedded into the Mazemap JS API are:
Besides all of Leaflet's classes, methods, events and options, the Mazemap JS API includes some functionality of its own. This is documented in the Mazemap API documentation.
The Mazemap JS API comes in two flavours: one for browsers that support Promises and the Fetch API, and one which includes a fetch polyfill and a promise polyfill, with wider browser support but slightly bigger size.
In order to use the slimmer flavour of the JS API, you'll need to include this in your web pages:
In order to use the polyfilled flavour, include this instead:
|File name||File size||MSIE||Firefox||Chrome||Safari|
|mazemap.min.js||235 KiB||No||Yes (39+)||Yes (42+)||No|
The Mazemap JS API does not work in MSIE 8.
The Mazemap JS API follows a few coding conventions from Leaflet. The most important ones are:
PascalCase(uppercased first letter) when referring to classes and constructors.
Maze.Mapis a class, and
new Maze.Mapis a constructor.
camelCase(lowercased first letter) when referring to instances, functions, methods, and factory methods.
Maze.mapis a factory method.
var foo = Maze.Map(...); // Wrong var foo = new Maze.Map(...); // OK, but not recommended var foo = Maze.map(...); // Best
Study examples on the example page
Simple instructions on how to implement the JS API is described on the "Get started" page