Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 1
//createPostScript.js
(function () {
  /*global adventurejs A*/

  var p = adventurejs.Game.prototype;

  /**
   * Utility to allow authors to inject custom scripts
   * to be called after inputParseComplete, aka end of turn.
   * @memberOf adventurejs.Game
   * @method adventurejs.Game#createPostScript
   * @kind function
   * @param {Object} object A generic object with properties to copy into a new classed object.
   * @returns {Object} The object that was passed in.
   */
  p.createPostScript = function Game_createPostScript(object) {
    var game = this;
    Object.entries(object).forEach(([id, value]) => {
      game.post_scripts[id] = value;
    });
    return object;
  };
})();