我正在laravel和angular js中工作。在laravel,我使用了事件广播并使用推送通知。而在角度上,我已订阅频道并收到该通知。重新加载页面时数据从变量中删除
现在,我将推送器数据存储到一个变量中,并将其显示为html。但是,当我重新加载页面比通知被删除。
角JS:
Pusher.logToConsole = true;
var pusher = new Pusher('Pusher-key', {
cluster: 'ap2',
encrypted: true
});
var channel = pusher.subscribe('ticket-'+$login_user_id);
channel.bind('ticket-notification', function(data) {
var i = $scope.notification.length;
$scope.notification[i] = {"id":data.ticket.id,"subject":data.ticket.subject};
$scope.total_notification = $scope.notification.length;
console.log($scope.total_notification);
});
this.update_notification = function(notification_id,index) {
$scope.notification.splice(index,1);
$scope.total_notification = $scope.notification.length;
}
现在,我想存储通知变量globally.So当我重装比它不能对变量影响页,并且还可以在其他浏览器中显示。
那么我该怎么做?
我不能在其他浏览器中使用它 –
我猜“另一个浏览器”是指同一浏览器的新窗口。因为如果没有服务器,从Chrome浏览器向Firefox传递数据是不可能的。 – satinja
可以使用PouchDB:https://www.tutorialspoint.com/pouchdb/pouchdb_read_document.htm 这对它有好处吗? Cz我对此毫不知情。 –