Skip to content

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

@QinJhonny

Description

@QinJhonny

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];
            }
        }
    };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions