Comments (6)
p.s. I'm interested in working on a PR for this feature if it's considered a worthwhile thing to add.
from react-hn.
I talked to @marcacohen about this feature a little offline. In short, the suggestion here is an opt-in mode for pre-fetching the first N external articles from the top stories page for offline reading.
This is an interesting problem that could be tackled in a few different ways:
I) Server-side 'readability' proxy We would need to self-host a service that takes a URL (a top story item), fetches just the article content and just returns a stripped down version. The user experience would be similar to what you get with Pocket. We would pre-fetch/offline these articles either on user-trigger or via requestIdleCallback
or the Background Sync API and just delegate to SW Toolbox the runtime caching side of offlining. Self-hosting is necessary due to the fun that is CORS. If I was starting with 1, I might use https://www.npmjs.com/package/node-readability (or similar) which looks like:
var read = require('node-readability');
read('http://www.nature.com/news/rats-free-each-other-from-cages-1.9603', function(err, article, meta) {
// Main Article
console.log(article.content);
// Title
console.log(article.title);
// Close article to clean up jsdom and prevent leaks
article.close();
});
II) Fetch via Service Worker We might be able to accomplish this entirely client-side by intercepting URLs from the top stories page via Service Worker, however, we may end up needing to wait on foreign fetch support to land depending on how complex this ends up being in practice. Service Worker can opaquely cache resources for offline, but this is somewhat limited. Fully offline functionality for intercepting requests from anywhere to resources in our scope would require FF afaik. We may end up being even more limited if FF is limited to only secure contexts.
I've tried playing around with link rel=preload
+ SW for this use cache but wasn't able to get far. @marcacohen, perhaps you could pick an approach you're keen on exploring and see how far you can get? As mentioned in person, my main concern isn't that we can't figure out a way to get the feature in place but more the server-side costs if this ends up being something that has to be done on GAE and might be expensive as the project grows.
from react-hn.
Did some research and found https://github.com/n1k0/readable-proxy/. Looks like we could fork and add SW support to test out your idea.
from react-hn.
Jake Archibald also pointed me to https://github.com/premii/hn as another
example to learn from.
On 4 July 2016 at 00:47, Addy Osmani [email protected] wrote:
Did some research and found https://github.com/n1k0/readable-proxy/.
Looks like we could fork and add SW support to test out your idea.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#56 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAoLl9GZUOcZrw53bJexIun50_78zlhDks5qSEn6gaJpZM4JCBiI
.
Marc Cohen
[email protected]
http://about.me/marc1
from react-hn.
@marcacohen After working on some more proof-of-concepts here, I think we could probably knock out this feature in under a week (same time if we were to guide you through it) 🎀 Are you still interested in working on it?
from react-hn.
Hi Addy,
Sorry for the delay. I'm up for taking a crack at this. Do you have any
refs you can point me to, or should we have a VC to cover your guidance
verbally?
Marc
On 16 July 2016 at 17:28, Addy Osmani [email protected] wrote:
@marcacohen https://github.com/marcacohen After working on some more
proof-of-concepts here, I think we could probably knock out this feature in
under a week (same time if we were to guide you through it) 🎀 Are you
still interested in working on it?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#56 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAoLl5Tx9-GU4lcQwe1Jxg39ICxX7c1uks5qWQbBgaJpZM4JCBiI
.
Marc Cohen
[email protected]
http://about.me/marc1
from react-hn.
Related Issues (20)
- LINK SEEMS DOWN HOT 2
- Add a section for stories you've looked at HOT 1
- Investigate using Lighthouse HOT 1
- Offline mode is broken HOT 5
- fresh repo clone fails during postinstall HOT 4
- Error - Not able to do 'npm run build' HOT 4
- manifest.d41d8cd9.js:1 Uncaught SyntaxError: Unexpected token <
- lighthouse: 'URL responds with a 200 when offline' doesn't pass HOT 2
- Points is not consistent
- Top stories HOT 1
- npm install fails HOT 2
- Sourcemap seems to be HTML
- Experiment: port over to using sw-helpers
- Question: react-router HOT 2
- Reloading development server HOT 1
- [email protected]: Failed to load resource: net::ERR_UNSAFE_REDIRECT
- Module not found: Error: Cannot resolve module 'history/lib/createHashHistory' HOT 1
- Why does show the first page items, then show blinking dots, then show the items again?
- WC HOT 2
- Live link down HOT 6
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 react-hn.