Add narrow_state.stream_sub() and narrow_state.stream_id().

This commit is contained in:
Steve Howell
2018-05-02 11:51:02 +00:00
committed by Tim Abbott
parent 0232e92038
commit a62c85c015
2 changed files with 35 additions and 0 deletions

View File

@@ -109,6 +109,31 @@ exports.stream = function () {
return;
};
exports.stream_sub = function () {
if (current_filter === undefined) {
return;
}
var stream_operands = current_filter.operands("stream");
if (stream_operands.length !== 1) {
return;
}
var name = stream_operands[0];
var sub = stream_data.get_sub_by_name(name);
return sub;
};
exports.stream_id = function () {
var sub = exports.stream_sub();
if (!sub) {
return;
}
return sub.stream_id;
};
exports.topic = function () {
if (current_filter === undefined) {
return;