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

clearSubscriptions would clear different topics which includes the same string #215

Open
QinJhonny opened this issue Dec 22, 2021 · 0 comments

Comments

@QinJhonny
Copy link

for example , topic "enter" and "entering",when I try to clear the topic "enter",it would clear topic 'entering' at the same time. I am quite confused why use 'indexOf' instead of '===',below is the method.

PubSub.clearSubscriptions = function clearSubscriptions(topic){
        var m;
        for (m in messages){
            if (messages.hasOwnProperty(m) && m.indexOf(topic) === 0 / * why use indexOf  here ?*/){
                delete messages[m];
            }
        }
    };
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

1 participant