Comments (4)
You're right.
Remember doing some testing that I couldn't discern the difference between "document_start"
and "document_end"
- I think due to the fact that the content script polls the background script to be initialized, but I don't know.
Anyway it's a better default. Added in local dev, will probably merge sometime over the weekend. Got some changes staged. (or make a PR :) Thanks!
update: Changing to "run_at": "document_start"
means document.body
doesn't exist when trying to append the overlay to the DOM. Don't really see how this could work.
from melatonin.
… why does it need to talk to the background script at all? A simple content script should be sufficient. Updating the overlay on page-loads should be sufficient for everything but reading books on a single page. Alternatively, force an update to the overlay every 15 minutes. Juts avoid messaging with the background service.
from melatonin.
Whether it talks to the background script or not, doesn't affect that you can't add the overlay to the DOM before it's loaded. Right?
It talks to the background script in order to set it's color.
In most cases this color is calculated based on geoposition and the user's configuration in the sense of keyframes. (i.e. "I want 4700K at 8 in the morning; 2700K at sundown"). I haven't tried putting all that logic into the content script, but it seems to me a bad idea to have it recalculated on each page load. Besides, you'd need to request geolocation each time, which I (and I haven't measured!) imagine to not be significantly faster than talking to the background script.
Sure, if you just want a static color, you could easily fit it into a content script. But I don't see how the (geoposition, time) to (color temperature) mapping would fit.
from melatonin.
@Aeyoun added 7e2bd21 to dev. Is this something like what you mean? In any case, testing it out I find it's a bit of an improvement. Doesn't eliminate all the flashing, but in many cases.
I'm interested to hear how you think the content script can be improved, as I didn't quite understand.
from melatonin.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from melatonin.