Ribcage-Google-Maps
This library adds support for Google Maps JavaScript API v3 to Ribcage apps.
It constists of models, collections, and views that help make working with the Maps API more like working with Backbone applications.
The library is still work in progress, so please don't expect miracles.
Requirements
This library depends on Ribcage and require-async module (if used with RequireJS). Naturally, it requires the Google Maps API v3 library. It also requires DaHelpers.
Installation
Ribcage-Google-Maps modules are in UMD format. This means you can either use
them with an AMD module loader such as RequireJS or
with classic <script>
tags. If you wish to use this library with an AMD
loader, please also consult the next section.
When loading modules using the <script>
tag, please make sure all.js
is
loaded before other modules. Also, when adding the modules using <script>
tags, the UMD wrapper will do a basic dependency check and you may receive
exceptions if the dependencies are not available.
Shimming the gmaps module
When using as AMD modules, you will need to adjust your RequireJS and build configuration. This is due to the way Google Maps API library is loaded, and because the API key can only be specified in the library's URL.
Please see API documentation in doc/gmaps.mkd
for
recommended setup. You may also substitute gmaps.js
with your own version
that does things differently (e.g., downloaded version of Google Maps API
library, etc).
Quick example
Here's a quick example with MapDataModel
and
MapView
:
var mapData = new MapDataModel({
lat: 37.783333,
long: -122.416667
});
var map = new MapView({model: mapData, el: '#map-canvas'});
map.render()
This should render a map within an element with id
attribute '#map-canvas'
centered on San Francisco.
API documentation
Complete API documentation is located in the doc
directory. These
files are Markdown files generated from the source code. Documentation for
main module contains links to individual modules.