Giter VIP home page Giter VIP logo

Comments (6)

mco-gh avatar mco-gh commented on August 14, 2024

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.

addyosmani avatar addyosmani commented on August 14, 2024

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.

addyosmani avatar addyosmani commented on August 14, 2024

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.

mco-gh avatar mco-gh commented on August 14, 2024

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.

addyosmani avatar addyosmani commented on August 14, 2024

@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.

mco-gh avatar mco-gh commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.