Fix callback function bind with object as parameter (#7984)

Signed-off-by: TAY TS <taytzushieh@gmail.com>
This commit is contained in:
TAY TS 2020-09-30 17:06:42 +08:00 committed by GitHub
parent f0d87b5d86
commit c9d827c1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -937,9 +937,11 @@ Prometheus.Page.prototype.init = function() {
if (graphOptions.length === 0) {
graphOptions.push({});
}
var pageInstance = this;
graphOptions.forEach(this.addGraph, this);
$("#add_graph").click(this.addGraph.bind(this, {}));
$("#add_graph").click(function() {
pageInstance.addGraph({});
});
};
Prometheus.Page.prototype.parseURL = function() {