diff --git a/v3/src/boot/Game.js b/v3/src/boot/Game.js index 6ccc7863f..3b9ce8012 100644 --- a/v3/src/boot/Game.js +++ b/v3/src/boot/Game.js @@ -16,6 +16,7 @@ var MainLoop = require('./MainLoop'); var CreateRenderer = require('./CreateRenderer'); var StateManager = require('../state/StateManager'); var TextureManager = require('../textures/TextureManager'); +var Data = require('../components/Data'); var Game = function (config) { @@ -44,6 +45,11 @@ var Game = function (config) */ // this.cache = new Cache(); + /** + * @property {Phaser.Data} registry - Game wide data store. + */ + this.registry = new Data(this); + /** * @property {Phaser.Input} input - Reference to the input manager */ diff --git a/v3/src/components/Data.js b/v3/src/components/Data.js index 08f370bbb..364dcba3f 100644 --- a/v3/src/components/Data.js +++ b/v3/src/components/Data.js @@ -4,6 +4,9 @@ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +var Event = require('../events/Event'); +var EventDispatcher = require('../events/EventDispatcher'); + /** * The Data Component features a means to store pieces of data specific to a Game Object, * search it, query it, and retrieve it. @@ -14,6 +17,8 @@ var Data = function (parent) { this.parent = parent; + this.events = new EventDispatcher(); + this.list = {}; this._beforeCallbacks = {}; @@ -82,6 +87,8 @@ Data.prototype = { } } + this.events.dispatch(new Event.LOADER_START_EVENT(this)); + this.list[key] = data; // If there is a 'after' callback, then check it for a result