Select Category (SOLVED)

Hey everyone,

im trying to figure out how to find the categorie that is selected at the moment. My goal is to write a console line if the weapon categorie is selected.
Here is what i have done so far:

Scene_Item.prototype.onCategoryOk = function() {
if (Window_ItemCategory == TextManager.weapon, 'weapon') {
console.log("Categorie weapon selected");
} else {
this._itemWindow.activate();
this._itemWindow.selectLast();
}

};

Unfortunately it doesnt matter wich categorie i select. It always write the line on the console. If anyone could help out i would be really happy.

SOLVED:

Scene_Item.prototype.onCategoryOk = function() {
if (this._itemWindow._category == "weapon") {
console.log("Categorie weapon selected");
} else {
console.log(this);
this._itemWindow.activate();
this._itemWindow.selectLast();
}

};

Took me 2 hours to find it out.

Original thread: https://forums.rpgmakerweb.com/threads/select-category-solved.81167/