<commit_before>var argscheck = require('cordova/argscheck'),
    utils = require('cordova/utils'),
    exec = require('cordova/exec'),
    common = require('./Common'),
    LatLng = require('./LatLng'),
    event = require('./event'),
    BaseClass = require('./BaseClass');

/*****************************************************************************
 * Marker Class
 *****************************************************************************/
var Marker = function(map, id, markerOptions) {
    BaseClass.apply(this);

    var self = this;

    Object.defineProperty(self, "map", {
        value: map,
        writable: false
    });
    Object.defineProperty(self, "hashCode", {
        value: markerOptions.hashCode,
        writable: false
    });
    Object.defineProperty(self, "id", {
        value: id,
        writable: false
    });
    Object.defineProperty(self, "type", {
        value: "Marker",
        writable: false
    });

    if (markerOptions && markerOptions.position) {
        self.set('position', markerOptions.position);
    }

    //-----------------------------------------------
    // Sets the initialize option to each property
    //-----------------------------------------------
    var ignores = ["map", "id", "hashCode", "type"];
    for (var key in markerOptions) {
        if (ignores.indexOf(key) === -1) {
            self.set(key, markerOptions[key]);
        }
    }

    //-----------------------------------------------
    // Sets event listeners
    //-----------------------------------------------

    if (markerOptions.infoWindow) {
      console.log("[deprecated] the infoWindow option is deprecated. Please use event listener.");
    }

    self.on(event.INFO_OPEN, function() {
        if (map.get("active_marker_id") === id) {
          return;
        }
        map.set('active_marker_id', id);

        if (markerOptions.infoWindow) {
            markerOptions.infoWindow.open(self);
        }
    });
    self.on(event.INFO_CLOSE, function() {

        if (markerOptions.infoWindow) {
            markerOptions.infoWindow.close(self);
        }
    });
    self.on(event.MARKER_CLICK, function() {
        self.trigger(event.INFO_OPEN);
    });


    self.on("position_changed", function(oldValue, position) {
        exec(null, self.errorHandler, self.getPluginName(), 'setPosition', [self.getId(), position.lat, position.lng]);
    });
    self.on("rotation_changed", function(oldValue, rotation) {
        exec(null, self.errorHandler, self.getPluginName(), 'setRotation', [self.getId(), rotation]);
    });
    self.on("snippet_changed", function(oldValue, snippet) {
        exec(null, self.errorHandler, self.getPluginName(), 'setSnippet', [self.getId(), snippet]);
    });
    self.on("visible_changed", function(oldValue, visible) {
        exec(null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
    });
    self.on("title_changed", function(oldValue, title) {
        exec(null, self.errorHandler, self.getPluginName(), 'setTitle', [self.getId(), title]);
    });
    self.on("icon_changed", function(oldValue, url) {
        exec(null, self.errorHandler, self.getPluginName(), 'setIcon', [self.getId(), url]);
    });
    self.on("flat_changed", function(oldValue, flat) {
        exec(null, self.errorHandler, self.getPluginName(), 'setFlat', [self.getId(), flat]);
    });
    self.on("draggable_changed", function(oldValue, draggable) {
        exec(null, self.errorHandler, self.getPluginName(), 'setDraggable', [self.getId(), draggable]);
    });
    self.on("anchor_changed", function(oldValue, anchor) {
        exec(null, self.errorHandler, self.getPluginName(), 'setIconAnchor', [self.getId(), anchor[0], anchor[1]]);
    });
    self.on("infoWindowAnchor_changed", function(oldValue, anchor) {
        exec(null, self.errorHandler, self.getPluginName(), 'setInfoWindowAnchor', [self.getId(), anchor[0], anchor[1]]);
    });
    self.on("zIndex_changed", function(oldValue, zIndex) {
        exec(null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
    });
    self.on("opacity_changed", function(oldValue, opacity) {
        exec(null, self.errorHandler, self.getPluginName(), 'setOpacity', [self.getId(), opacity]);
    });
    self.on("disableAutoPan_changed", function(oldValue, disableAutoPan) {
        exec(null, self.errorHandler, self.getPluginName(), 'setDisableAutoPan', [self.getId(), disableAutoPan]);
    });

};

utils.extend(Marker, BaseClass);

Marker.prototype.getPluginName = function() {
    return this.map.getId() + "-marker";
};

Marker.prototype.remove = function(callback) {
    var self = this;
    self.trigger(self.id + "_remove");
    exec(function() {<commit_msg>Fix: Closing HTMLInfoWindow when removing marker<commit_after>var argscheck = require('cordova/argscheck'),
    utils = require('cordova/utils'),
    exec = require('cordova/exec'),
    common = require('./Common'),
    LatLng = require('./LatLng'),
    event = require('./event'),
    BaseClass = require('./BaseClass');

/*****************************************************************************
 * Marker Class
 *****************************************************************************/
var Marker = function(map, id, markerOptions) {
    BaseClass.apply(this);

    var self = this;

    Object.defineProperty(self, "map", {
        value: map,
        writable: false
    });
    Object.defineProperty(self, "hashCode", {
        value: markerOptions.hashCode,
        writable: false
    });
    Object.defineProperty(self, "id", {
        value: id,
        writable: false
    });
    Object.defineProperty(self, "type", {
        value: "Marker",
        writable: false
    });

    if (markerOptions && markerOptions.position) {
        self.set('position', markerOptions.position);
    }

    //-----------------------------------------------
    // Sets the initialize option to each property
    //-----------------------------------------------
    var ignores = ["map", "id", "hashCode", "type"];
    for (var key in markerOptions) {
        if (ignores.indexOf(key) === -1) {
            self.set(key, markerOptions[key]);
        }
    }

    //-----------------------------------------------
    // Sets event listeners
    //-----------------------------------------------

    if (markerOptions.infoWindow) {
      console.log("[deprecated] the infoWindow option is deprecated. Please use event listener.");
    }

    self.on(event.INFO_OPEN, function() {
        if (map.get("active_marker_id") === id) {
          return;
        }
        map.set('active_marker_id', id);

        if (markerOptions.infoWindow) {
            markerOptions.infoWindow.open(self);
        }
    });
    self.on(event.INFO_CLOSE, function() {

        if (markerOptions.infoWindow) {
            markerOptions.infoWindow.close(self);
        }
    });
    self.on(event.MARKER_CLICK, function() {
        self.trigger(event.INFO_OPEN);
    });


    self.on("position_changed", function(oldValue, position) {
        exec(null, self.errorHandler, self.getPluginName(), 'setPosition', [self.getId(), position.lat, position.lng]);
    });
    self.on("rotation_changed", function(oldValue, rotation) {
        exec(null, self.errorHandler, self.getPluginName(), 'setRotation', [self.getId(), rotation]);
    });
    self.on("snippet_changed", function(oldValue, snippet) {
        exec(null, self.errorHandler, self.getPluginName(), 'setSnippet', [self.getId(), snippet]);
    });
    self.on("visible_changed", function(oldValue, visible) {
        exec(null, self.errorHandler, self.getPluginName(), 'setVisible', [self.getId(), visible]);
    });
    self.on("title_changed", function(oldValue, title) {
        exec(null, self.errorHandler, self.getPluginName(), 'setTitle', [self.getId(), title]);
    });
    self.on("icon_changed", function(oldValue, url) {
        exec(null, self.errorHandler, self.getPluginName(), 'setIcon', [self.getId(), url]);
    });
    self.on("flat_changed", function(oldValue, flat) {
        exec(null, self.errorHandler, self.getPluginName(), 'setFlat', [self.getId(), flat]);
    });
    self.on("draggable_changed", function(oldValue, draggable) {
        exec(null, self.errorHandler, self.getPluginName(), 'setDraggable', [self.getId(), draggable]);
    });
    self.on("anchor_changed", function(oldValue, anchor) {
        exec(null, self.errorHandler, self.getPluginName(), 'setIconAnchor', [self.getId(), anchor[0], anchor[1]]);
    });
    self.on("infoWindowAnchor_changed", function(oldValue, anchor) {
        exec(null, self.errorHandler, self.getPluginName(), 'setInfoWindowAnchor', [self.getId(), anchor[0], anchor[1]]);
    });
    self.on("zIndex_changed", function(oldValue, zIndex) {
        exec(null, self.errorHandler, self.getPluginName(), 'setZIndex', [self.getId(), zIndex]);
    });
    self.on("opacity_changed", function(oldValue, opacity) {
        exec(null, self.errorHandler, self.getPluginName(), 'setOpacity', [self.getId(), opacity]);
    });
    self.on("disableAutoPan_changed", function(oldValue, disableAutoPan) {
        exec(null, self.errorHandler, self.getPluginName(), 'setDisableAutoPan', [self.getId(), disableAutoPan]);
    });

};

utils.extend(Marker, BaseClass);

Marker.prototype.getPluginName = function() {
    return this.map.getId() + "-marker";
};

Marker.prototype.remove = function(callback) {
    var self = this;
    self.trigger(event.INFO_CLOSE);     // close open infowindow, otherwise it will stay
    self.trigger(self.id + "_remove");
    exec(function() {
{'fraction_non_alphanumeric': 0.2259305468912456, 'fraction_numerical': 0.001039717196922437, 'mean_word_length': 2.873942811115586, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6908137', 'n_tokens_mistral': 2743, 'n_tokens_neox': 2732, 'n_words': 507}