<commit_before>var Namespace = require('../classes/Namespace.js');
var Endpoint = require('../classes/Endpoint.js');
var publishers = Object.create(null);

var PublisherNamespace = function(name, owner) {
    Namespace.call(this, name, owner);

    this.methods.init = function(callback) {
        callback(this._lastData);
    }.bind(this);
};

PublisherNamespace.prototype = Object.create(Namespace.prototype);
PublisherNamespace.prototype._lastData = null;
PublisherNamespace.prototype.publish = function(payload) {
    this._lastData = payload;
    Namespace.send(this.owner, [{
        type: 'data',
        ns: this.name,
        payload: payload
    }]);
};

var Publisher = function(id, getRemoteUI) {
    Endpoint.call(this);
    this.id = id;
    this.getRemoteUI = getRemoteUI;

    publishers[id] = this;
    Publisher.onPublishersChange(Object.keys(publishers));
};<commit_msg>use `provide` method to define `init` remote method<commit_after>var Namespace = require('../classes/Namespace.js');
var Endpoint = require('../classes/Endpoint.js');
var publishers = Object.create(null);

var PublisherNamespace = function(name, owner) {
    Namespace.call(this, name, owner);

    this.provide('init', function(callback) {
        callback(this._lastData);
    }.bind(this));
};

PublisherNamespace.prototype = Object.create(Namespace.prototype);
PublisherNamespace.prototype._lastData = null;
PublisherNamespace.prototype.publish = function(payload) {
    this._lastData = payload;
    Namespace.send(this.owner, [{
        type: 'data',
        ns: this.name,
        payload: payload
    }]);
};

var Publisher = function(id, getRemoteUI) {
    Endpoint.call(this);
    this.id = id;
    this.getRemoteUI = getRemoteUI;

    publishers[id] = this;
    Publisher.onPublishersChange(Object.keys(publishers));
};
{'fraction_non_alphanumeric': 0.1423076923076923, 'fraction_numerical': 0.0, 'mean_word_length': 3.948369565217391, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '739125', 'n_tokens_mistral': 560, 'n_tokens_neox': 527, 'n_words': 101}