Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// updateCompasses.js

(function() {
  /*global adventurejs A*/ 
  "use strict";

	var p = adventurejs.Display.prototype;

	/**
	 * Set exits in status bar and custom compass roses.
	 * @method adventurejs.Display#updateCompasses
   * @param {String} exits
	 */
	p.updateCompasses = function Display_updateCompasses(exits) 
  {
    this.compasses.forEach(function(element){
      let compass = element.querySelector('.ajs-compasspoints');
      compass?.setAttribute('class',`ajs-compasspoints ${exits}`);
      compass?.querySelectorAll('.ajs-compasspoint').forEach(function(point){
        let disabled = (-1 === exits.indexOf(point.dataset.exit));
        point.setAttribute("aria-disabled", disabled ); 
      });

    })
	}
  
}());