Browse Source

Tweaks

dev
Bryan Miller 6 years ago
parent
commit
1c0213ac24
1 changed files with 20 additions and 3 deletions
  1. +20
    -3
      app/js/ctrls/CTRLBanksStore.js

+ 20
- 3
app/js/ctrls/CTRLBanksStore.js View File

constructor(){ constructor(){
var HANDLE_ChangeSurface = function(surf){ var HANDLE_ChangeSurface = function(surf){
if (!(surf instanceof NESBank)){ if (!(surf instanceof NESBank)){
// TODO: Unselect any current bank element. if (CurrentBank !== ""){
CurrentBankIndex = ""; Banks[CurrentBank].el.classList.remove(BLI_SELECTED);
CurrentBank = "";
}
} else { } else {
if (Banks.length <= 0 || (CurrentBank !== "" && Banks[CurrentBank].bank !== surf)){ if (Banks.length <= 0 || (CurrentBank !== "" && Banks[CurrentBank].bank !== surf)){
console.log("WARNING: Bank object being set outside of Bank Store."); console.log("WARNING: Bank object being set outside of Bank Store.");
} }
} }
GlobalEvents.listen("change_surface", HANDLE_ChangeSurface); GlobalEvents.listen("change_surface", HANDLE_ChangeSurface);


GlobalEvents.listen("bankstore-add", (function(e){
if (e.hasOwnProperty("bankname")){
this.createBank(e.bankname);
this.activateBank(e.bankname);
}
}).bind(this));

GlobalEvents.listen("bankstore-remove", (function(e){
if (CurrentBank !== "")
this.removeBank(CurrentBank);
}).bind(this));
} }


get length(){ get length(){
Banks[name].el.parentNode.removeChild(Banks[name].el); Banks[name].el.parentNode.removeChild(Banks[name].el);
delete Banks[name]; delete Banks[name];
if (CurrentBank !== ""){ if (CurrentBank !== ""){
// TODO: Activate new Bank. Banks[CurrentBank].el.click();
} else {
GlobalEvents.emit("change_surface", null);
} }
} }
return this; return this;

Loading…
Cancel
Save