以编程方式访问所有新的Chrome通知 [英] Access all new Chrome Notifications programmatically

查看:48
本文介绍了以编程方式访问所有新的Chrome通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前没有对Google Chrome插件进行编程的经验,这就是为什么我从这里开始看看我想完成的事情是否可行/合理的原因.但是,我在编程方面确实有相当丰富的经验.

I have no previous experience with programming Google Chrome plugins which is why I am starting here to see if what I want to accomplish is possible/reasonable. I do however have a pretty broad experience in programming in general.

我想要什么:当新的Chrome通知(您知道系统托盘上方的这些小弹出窗口)弹出时,我希望能够触发某种触发".我想根据通知包含的信息执行一些脚本/代码,例如,如果我收到来自某个主题中带有特定关键字的某个用户的电子邮件并从我的弹出窗口中发出警报,则该警报可能会响起Gmail通知程序扩展程序.但是,这只是一个示例,对于来自不同扩展名和网站的不同通知,我有很多想法,所以请不要着迷于该特定示例.

What I want: I want some kind of "trigger" to go off when a new Chrome Notification (you know these little pop ups above the system tray) is popping up. I want to execute some script/code depending on what information the notification contains so that I for example could have an alarm go off if I receive an email from a certain user with a certain key word in the subject and get a pop up from my Gmail Notifier extension. This is however just an example and I have a bunch of ideas for different notifications from different extensions and websites so don't get caught up on that particular example.

当我查看 Chrome Notification API 时,我发现有一个getAll方法可以据说正在获取所有系统中的通知",但我找不到新通知的任何事件.我想可能是每秒对getAll进行几次轮询(对于我想到的某些实现,它确实需要非常快),但是感觉很俗气.

When I look at the Chrome Notification API I see that there is a getAll method that supposedly is getting all the "notifications in the system" but I do not find any Event for new notifications. I suppose a possibility would be to poll with getAll a couple of times per second (it needs to be really fast for some implementations I have in mind) but it feels very tacky.

有什么方法可以在Chrome中以编程方式轻松访问新的通知吗?(我接受所有解决方案,编程语言等...)

Is there any way to easily access new Notifications programmatically in Chrome? (I'm open to all solutions, programming languages and such...)

推荐答案

好吧,我经过漫长而艰苦的搜寻,并参与了Chromium开发人员小组,并在那里询问.据我所知,没有合理的方式以编程方式访问所有通知.

Well, I searched long and hard and got involved with the Chromium dev group and asked around there. As far as I could figure out there was no reasonable way of accessing all Notifications programatically.

因此,我最终要做的就是下载Chromium的源代码,并添加非常原始的API来构建自己的自定义版本的Chrome.像魅力一样运作,而且没有人们想象的那么复杂.

So what I ended up doing was just download the source-code of Chromium and build my own custom version of chromium adding a very crude API. Worked like a charm and not as complicated as one might think.

干杯!

这篇关于以编程方式访问所有新的Chrome通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆