Clear all Session variables at logout

Is there any simple way to clean up all the values in the Session dictionary?

I think the latest Meteor release has a clear() method on the ReactiveDict prototype (looking at source). If you are on 1.1 or something you should be able to just patch ReactiveDict like this

ReactiveDict.prototype.clear = function () {
    for (key in this.keys) {
        this.set(key, undefined);
    }
};

=> Session.clear();
4 Likes