在尝试使用const GROUP_BY = 'mac';
const COMPARE_KEY = 'rssi';
const BUFFER_SIZE = 3;
const DISTINCT_BY_FIELDS = ['nodeId', 'mac'];
const comparer = field => (a, b) => (a[field] < b[field] ? -1 : 1);
const distinctFieldsComparer = fields => (x, y) => fields.every(field => x[field] === y[field]);
source
.pipe(
groupBy(metric => metric[GROUP_BY]),
mergeMap(group =>
group.pipe(
bufferCount(BUFFER_SIZE, 1),
mergeMap(metric => from(metric).pipe(max(comparer(COMPARE_KEY)))),
distinctUntilChanged(distinctFieldsComparer(DISTINCT_BY_FIELDS))
)
)
)
.subscribe(e => {
console.log(e);
});
生成通知时,我注意到输入汉字似乎终止了该通知。
我正在尝试实现多行通知,并且可以使用
以普通文本的形式实现public abstract class Animal
{
public abstract void makeSound()
{
Console.WriteLine("[nothing happens]");
}
}
public class Cat : Animal
{
public override void makeSound()
{
Console.WriteLine("Meow");
}
}
public class Dog : Animal
{
public override void makeSound()
{
Console.WriteLine("Woof");
}
}
public static void main(String[] args)
{
var animals = new List<Animal>();
animals.Add(new Dog());
animals.Add(new Cat());
Console.Add(animals[0].MakeSound()); // Woof
Console.Add(animals[1].MakeSound()); // Meow
}
产生这样的通知:
notify-send
包含汉字允许它们出现在通知中,但之后将不允许创建任何新行
notify-send "Heading" "line1 \n line2 \n line3"
产生:
Heading
line1
line2
line3
,缺少第三行。
有什么办法可以克服这个问题?
奇怪的是,如果我将第三行也设置为字符,那么它将起作用:
notify-send "Heading" "line1 \n 某事 \n line3"
给予:
Heading
line1
某事