我的目标是在firebase中的值更改时使用Chrome扩展程序创建通知.
使用下面的代码,我第一次更改值时收到通知,但不是以下时间.
f.on('child_changed', function (snapshot) {
ignoreInitialData = false;
var options = {
type: 'basic',
iconUrl: '../../icons/green.png',
title: "Availability notifier",
message: snapshot.val(),
contextMessage: "",
eventTime: Date.now(),
isClickable: false,
};
chrome.notifications.create("child_changed", options, function (notificationID) {
console.error(chrome.runtime.lastError);
});
});
Run Code Online (Sandbox Code Playgroud)
有解决方案吗