Skip to content

Instantly share code, notes, and snippets.

@hpneo
Created March 31, 2013 14:40
Show Gist options
  • Save hpneo/5280821 to your computer and use it in GitHub Desktop.
Save hpneo/5280821 to your computer and use it in GitHub Desktop.
GMaps.MarkerCollection = function GMaps.MarkerCollection(markers, options) {
this.markers = markers || [];
var scopes = options.scopes;
for (var i in scopes) {
if (this[i] == undefined) {
this[i] = function() {
var new_collection = [];
for (j = 0; j < this.markers.length; j++) {
var marker = this.markers[j];
if (scopes[i].call(marker.detail) === true) {
new_collection.push(marker);
}
}
return new_collection;
};
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment