Hacker Newsnew | past | comments | ask | show | jobs | submit | Heqx's commentslogin

Please consider the UX of your state toggles. The red/green states will be difficult for color-blind users to discern and, color aside, it's tough to tell which is the active state.


I hear you. But, isn't this just an editor's draft spec? Only Chrome and Android have done any implementation at all. So, as far as I can tell, there's a chance this will never be fully implemented? And, because it's a draft, the spec could change significantly. Is that right?


A spec being draft seems like an odd reason to ignore it and do a completely different API.

Intersection Observer has been implemented in Chrome since 51, and Opera since 38. It's currently being implemented in Firefox ( https://bugzilla.mozilla.org/show_bug.cgi?id=1243846 ), and is "likely" from Edge (https://developer.microsoft.com/en-us/microsoft-edge/platfor... ).

in-view.js's API is certainly less likely to be the cross-platform API than Intersection Observer. Also, plenty of APIs are implemented by browsers at the editor's draft stage.


I was sincerely asking all of those questions. I'm not very familiar with the process these specs go through to reach adoption.


All the more reason to experiment with the proposed standard API and contribute feedback.

The advantages of standardization and eventual native implementation outweigh the immediacy of a JS-based API designed in relative isolation. Why should I invest time learning this micro-library, when the API is certain to be different from the native implementation? The documentation doesn't seem to even acknowledge the existance of the standard (did the author do any research before implementing a one-off library? I have no way of knowing.), much less explain why it differs from the proposed standard.


Hey, author here. I'm very open to ideas to reduce bloat. It's 140 SLOC and ~1.1kb gzipped without lodash/throttle. I considered writing my own throttle, but wanted something more battle-tested.

Does Rollup produce a more efficient bundle in your experience?


Not sure why I was downvoted, I think it's a valid point. To prove it, here's the functionality of your library in ES5 with a naive throttle function: https://gist.github.com/nathancahill/f7ea239306737f2075a94de...

Minified (1.49kb) and gzipped (677b).

Whether lodash functions should be used instead of naive functions is up for debate. My opinion is if the lodash functions are 5x the size of the entire library, it's probably best to not include it, or to include it as a build option (if the user's project already includes lodash for example).


No worries, lodash/debounce can be reduced further with babel+webpack plugins.

Assuming the current setup of babel+webpack the difference between your naive version is just ~0.5 kB.


Which still doubles the size of the library: ~0.6kb to ~1.1kb. So while it's just half a kilobyte, do that over and over, with nested dependencies and it really adds up.



Can you point me to an explanation of the differences between the 'lodash.throttle' module and importing 'lodash/throttle'?


lodash.throttle is a standalone zero-dependency package of just the throttle module. The `lodash` package is a collection of modules one of which is `lodash/throttle`.

You can generally get smaller bundles using `lodash/xyz` modules over the `lodash.xyz` packages because of plugins like:

https://github.com/lodash/babel-plugin-lodash

https://github.com/lodash/lodash-webpack-plugin

Though in the future lodash-webpack-plugin may support `lodash.xyz` packages too.


You should get about the same results using a bundler. Perhaps the lodash.throttle package is for reducing `npm install` time or reducing bloat if you check in your node modules?


OP is using that already.


rollup can only load the functions of lodash you actually use into your bundle


So can lodash. That's what the author is doing here by using

  import throttle from 'lodash/throttle';
rather than

  import { throttle } from 'lodash';


Any time you're performing an operation on a scroll event, that is a risk. But this uses a single "scroll" event listener throttled to fire a maximum of every 100ms.

https://github.com/camwiegert/in-view/blob/master/src/in-vie...


I just finished writing this little side project. It was inspired by the effect on http://oak.is. I'd love to get feedback in the form of issues & pull requests.

This is the first library I've written completely in ES6, which was a pleasure. I hope you enjoy it!


I think it'd be responsible to recommend generating a new key pair specifically for this platform. Disregarding that, I think this is really cool.


I've noticed several people in this thread asking for Simple invites. I have three available. Message me with an email if you'd like one.


I would like one, if you have any available. Rtmagner@gmail.com


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: