chrome扩展crx构建_我如何构建TinyMails:Chrome扩展程序,可帮助您编写较短的电子邮件...

chrome扩展crx构建

by Florent Crivello

由Florent Crivello

我如何构建TinyMails:Chrome扩展程序,可帮助您编写较短的电子邮件 (How I built TinyMails: a chrome extension that helps you write shorter emails)

I’ve been complaining about the death of brevity for a while now. Personal correspondence — especially emails — are as verbose as ever.

我一直在抱怨短暂的死亡。 个人信件(尤其是电子邮件)一如既往地冗长。

Some of this is because it’s now much easier to generate a lot of content (computers are faster than typewriters, which are faster than longhand).

之所以这样,是因为现在生成大量内容要容易得多(计算机比打字机快,比打字机快)。

When you compose an email, your email clients greet you with a Nice Giant Text Field that seems to be saying: “Now is the time to write that novel you’ve been dreaming of!” Compare this to the ridiculously tiny text field of IM apps (in blue):

当您撰写电子邮件时,您的电子邮件客户会用一个不错的巨型文本字段向您打招呼:“现在是时候写您梦novel以求的小说了!” 将此与IM应用程序的可笑的微小文本字段(蓝色)进行比较:

Granted, emails are richer in content than instant messages, but I also think that people would be nudged into writing much shorter emails if that box were smaller (and auto expanded as you type, like in Facebook Messenger).

诚然,电子邮件的内容比即时消息更丰富,但是我还认为,如果该框较小(并且在键入时会自动扩展,例如在Facebook Messenger中自动扩展),人们就会被迫编写短得多的电子邮件。

So, in the spirit of “don’t complain about X, build Y instead,” I built TinyMails, my first Chrome extension. As you’re composing an email, TinyMails shows you how many words you’ve written, along with an estimate of how long it’ll take to read it. It also gradually makes the estimate’s text more and more red as the email gets longer and longer.

因此,本着“不要抱怨X,而要构建Y”的精神,我构建了我的第一个Chrome扩展程序TinyMails 。 在撰写电子邮件时,TinyMails会向您显示您写了多少个单词,并估算了阅读需要多长时间。 随着电子邮件变得越来越长,它也逐渐使估算文本变得越来越红。

You can download it here on the Chrome WebStore, upvote it on ProductHunt, and passive-aggressively send it to everyone you know who tends to be verbose in their emails (I for one added a link to my signature).

您可以在Chrome WebStore上将其下载,在ProductHunt上对其进行投票 ,然后将其被动地发送给您认识的每个人,这些人在电子邮件中通常都很冗长(我为我的签名添加了一个链接)。

技术资料 (The Technical Stuff)

For the curious ones, I put the source of the extension here on GitHub. I used the amazing InboxSDK, which gives a high level API to deal with Gmail / Inbox, allowing me to focus on the actual logic of my extension, and to build it in 2 or 3 hours.

对于好奇的人,我将扩展的源代码放在GitHub上 。 我使用了令人惊叹的InboxSDK ,它提供了高级API来处理Gmail / Inbox,使我可以专注于扩展程序的实际逻辑,并在2到3个小时内完成构建。

As I was coding and profiling it, I noticed it was a lot more computation-heavy than I’d thought. Part of this is just JavaScript being JavaScript. But I also do this thing where — every time a key is pressed — I clone the entire DOM of the composing text field so that I’m able to remove the signature from the word count. It turns out that this is non-trivial, so I made it do this at most 5 times per second. This is frequently enough to feel real time, but more energy efficient than the previous behavior.

在编码和分析时,我发现它比我想象的要耗费大量的计算资源。 其中一部分只是JavaScript就是JavaScript。 但是,我也会在每次按下键时都克隆组成文本字段的整个DOM,以便能够从字数统计中删除签名。 事实证明,这是不平凡的,所以我使其每秒最多执行5次。 这通常足以感觉到实时,但比以前的行为更节能。

Feel free to reach out on Twitter (@Altimor) for feedback/suggestions, and leave a review if you like it :)

随时联系Twitter( @Altimor )以获取反馈/建议,如果您喜欢它,请留下评论:)

翻译自: https://www.freecodecamp.org/news/announcing-tinymails-a-simple-extension-that-helps-you-write-shorter-emails-ff89329a4f21/

chrome扩展crx构建

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值