Added Markdown editor and Javascript code refactoring
This commit is contained in:
33
assets/js/src/BoardPolling.js
Normal file
33
assets/js/src/BoardPolling.js
Normal file
@@ -0,0 +1,33 @@
|
||||
Kanboard.BoardPolling = function(app) {
|
||||
this.app = app;
|
||||
};
|
||||
|
||||
Kanboard.BoardPolling.prototype.execute = function() {
|
||||
if (this.app.hasId("board")) {
|
||||
var interval = parseInt($("#board").attr("data-check-interval"));
|
||||
|
||||
if (interval > 0) {
|
||||
window.setInterval(this.check.bind(this), interval * 1000);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Kanboard.BoardPolling.prototype.check = function() {
|
||||
if (this.app.isVisible() && !this.app.get("BoardDragAndDrop").savingInProgress) {
|
||||
var self = this;
|
||||
this.app.showLoadingIcon();
|
||||
|
||||
$.ajax({
|
||||
cache: false,
|
||||
url: $("#board").data("check-url"),
|
||||
statusCode: {
|
||||
200: function(data) {
|
||||
self.app.get("BoardDragAndDrop").refresh(data);
|
||||
},
|
||||
304: function () {
|
||||
self.app.hideLoadingIcon();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user