e90735ed6e
Summary: This diff is designed to dramatically speed up new window load time for all window types and reduce memory consumption of our hot windows. Before this diff, windows loaded in ~3 seconds. They now boot in a couple hundred milliseconds without requiring to keep hot windows around for each and every type of popout window we want to load quickly. One of the largest bottlenecks was the `require`ing and initializing of everything in `NylasExports`. I changed `NylasExports` to be entirely lazily-loaded. Drafts and tasks now register their constructors with a `StoreRegistry` and the `TaskRegistry`. This lets us explicitly choose a time to activate these stores in the window initalization instead of whenever nylas-exports happens to be required first. Before, NylasExports was required first when components were first rendering. This made initial render extremely slow and made the proposed time picker popout slow. By moving require into the very initial window boot, we can create a new scheme of hot windows that are "half loaded". All of the expensive require-ing and store initialization is done. All we need to do is activate the packages for just the one window. This means that the hot window scheme needs to fundamentally change from have fully pre-loaded windows, to having half-loaded empty hot windows that can get their window props overridden again. This led to a major refactor of the WindowManager to support this new window scheme. Along the way the API of WindowManager was significantly simplifed. Instead of a bunch of special-cased windows, there are now consistent interfaces to get and `ensure` windows are created and displayed. This DRYed up a lot of repeated logic around showing or creating core windows. This also allowed the consolidation of the core window configurations into one place for much easier reasoning about what's getting booted up. When a hot window goes "live" and gets populated, we simply change the `windowType`. This now re-triggers the loading of all of the packages for the window. All of the loading time is now just for the packages that window requires since core Nylas is there thanks to the hot window mechanism. Unfortunately loading all of the packages for the composer was still unnaceptably slow. The major issue was that all of the composer plugins were taking a long time to process and initialize. The solution was to have the main composer load first, then trigger another window load settings change to change the `windowType` that loads in all of the plugins. Another major bottleneck was the `RetinaImg` name lookup on disk. This requires traversing the entire static folder synchronously on boot. This is now done once when the main window loads and saved in a cache in the browser process. Any secondary windows simply ask the backend for this cache and save the filesystem access time. The Paper Doc below is the current set of manual tests I'm doing to make sure no window interactions (there are a lot of them!) regressed. Test Plan: https://paper.dropbox.com/doc/Window-Refactor-UYsgvjgdXgVlTw8nXTr9h Reviewers: juan, bengotow Reviewed By: bengotow Differential Revision: https://phab.nylas.com/D2916 |
||
---|---|---|
apm | ||
build | ||
docs | ||
dot-nylas | ||
examples | ||
internal_packages | ||
keymaps | ||
menus | ||
script | ||
spec | ||
spec_integration | ||
src | ||
static | ||
.eslintrc | ||
.gitignore | ||
.gitmodules | ||
.travis.yml | ||
appveyor.yml | ||
CHANGELOG.md | ||
CONFIGURATION.md | ||
CONTRIBUTING.md | ||
ISSUE_TEMPLATE.md | ||
LICENSE.md | ||
N1.sh | ||
package.json | ||
README.md |
N1 is an open-source mail client built on the modern web with Electron, React, and Flux. It is designed to be extensible, so it's easy to create new experiences and workflows around email. N1 is built on the Nylas Sync Engine which is also open source free software.
![GitHub issues On Deck](https://badge.waffle.io/nylas/N1.png?label=on deck&title=On Deck)
Want help build the future of email? Nylas is hiring!
Download N1
You can download compiled versions of N1 for Windows, Mac OS X, and Linux (.deb) from https://nylas.com/N1. You can also build and run N1 on Fedora. A Fedora distribution is coming soon!
Build A Plugin
Plugins lie at the heart of N1 and give it its powerful features. Building your own plugins allows you to integrate the app with other tools, experiment with new workflows, and more. Follow the Getting Started guide to write your first plugin in 5 minutes. To create your own theme, go to our Theme Starter guide.
If you would like to run the N1 source and contribute, check out our contributing guide.
Plugin List
We're working on building a plugin index that makes it super easy to add them to N1. For now, check out the list below! (Feel free to submit a PR if you build a plugin and want it featured here.)
Bundled Themes
- Dark
- Darkside (designed by Jamie Wilson)
- Taiga (designed by Noah Buscher)
- Ubuntu (designed by Ahmed Elhanafy)
Community Themes
- Arc Dark
- Predawn
- ElementaryOS
- Ido — Polymail-inspired theme
- Solarized Dark
- Berend
- LevelUp
- Sunrise
- Less Is More
- ToogaBooga
- Material
- Monokai
Bundled Plugins
Great starting points for creating your own plugins!
- Translate — Works with 10 languages
- Scheduler — Show your availability to schedule a meeting with someone
- Quick Replies — Send emails faster with templates
- Send Later — Schedule your emails to be sent at a later time
- Open Tracking — See if your emails have been read
- Link Tracking — See if your links have been clicked
- Emoji Keyboard — Insert emoji by typing a colon (:) followed by the name of an emoji symbol
- GitHub Sidebar Info
- View on GitHub
- Personal Level Indicators
- Phishing Detection
Community Plugins
- Jiffy — Insert animated GIFs
- Weather
- Todoist
- Unsubscribe
- Squirt Speed Reader
- In Development: Cypher (PGP Encryption)
Running Locally
By default the N1 source points to our hosted version of the Nylas Sync Engine; however, the Sync Engine is open source and you can run it yourself.
Feature Requests / Plugin Ideas
Have an idea for a package, or a feature you'd love to see in N1? Check out our public Trello board to contribute your thoughts and vote on existing ideas.