<commit_before>/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author <NAME> */
/** @author <NAME> */

var Stream = require('../Stream');
var dispose = require('../disposable/dispose');
var MulticastSource = require('@most/multicast').MulticastSource;
var PropagateTask = require('../scheduler/PropagateTask');

exports.periodic = periodic;

/**
 * Create a stream that emits the current time periodically
 * @param {Number} period periodicity of events in millis
 * @param {*) value value to emit each period
 * @returns {Stream} new stream that emits the current time every period
 */
function periodic(period, value) {
	return new Stream(new MulticastSource(new Periodic(period, value)));
}

function Periodic(period, value) {
	this.period = period;
	this.value = value;
}

Periodic.prototype.run = function(sink, scheduler) {
	return scheduler.periodic(this.period, new PropagateTask(emit, this.value, sink));
};

function emit(t, x, sink) {
	sink.event(t, x);
}<commit_msg>Stop multicasting periodic by default (#273)<commit_after>/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author <NAME> */
/** @author <NAME> */

var Stream = require('../Stream');
var dispose = require('../disposable/dispose');
var PropagateTask = require('../scheduler/PropagateTask');

exports.periodic = periodic;

/**
 * Create a stream that emits the current time periodically
 * @param {Number} period periodicity of events in millis
 * @param {*} value value to emit each period
 * @returns {Stream} new stream that emits the current time every period
 */
function periodic(period, value) {
	return new Stream(new Periodic(period, value));
}

function Periodic(period, value) {
	this.period = period;
	this.value = value;
}

Periodic.prototype.run = function(sink, scheduler) {
	return scheduler.periodic(this.period, PropagateTask.event(this.value, sink));
};
{'fraction_non_alphanumeric': 0.1392075078206465, 'fraction_numerical': 0.009906152241918665, 'mean_word_length': 4.904615384615385, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2321580', 'n_tokens_mistral': 590, 'n_tokens_neox': 559, 'n_words': 183}