Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent parameter when emitting event 'removedata' in DataManager.js #4186

Closed
gadelan opened this issue Nov 22, 2018 · 1 comment
Closed

Comments

@gadelan
Copy link

gadelan commented Nov 22, 2018

Version

  • Phaser Version: 3.15.1 also in master branch
  • Operating system: Not specific to an OS.
  • Browser: Not specific to a browser.

Description

The event 'removedata' is emitted in two places in DataManager.js. In removeValue() is emitted with this.parent as first parameter. What is passed is an EventEmitter: the GameObject (extended from EventEmitter) or the EventEmitter of a Game.

    removeValue: function (key)
    {
        if (this.has(key))
        {
            var data = this.list[key];

            delete this.list[key];
            delete this.values[key];

            this.events.emit('removedata', **this.parent**, key, data);
        }

        return this;
    },

But in pop() is emitted with this as first parameter. This emission passes the DataManager (and it is not an EventEmitter).

    pop: function (key)
    {
        var data = undefined;

        if (!this._frozen && this.has(key))
        {
            data = this.list[key];

            delete this.list[key];
            delete this.values[key];

            this.events.emit('removedata', **this**, key, data);
        }

        return data;
    },

Additional Information

This is probably a typo, but my knowledge of the source code is not enough to be sure of it. If this is found to be a bug, fixing it would be easy.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants