From 5e215adb687e55800d3e5f427ece5b27573899bd Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Fri, 17 Apr 2015 19:10:04 -0400 Subject: [PATCH 1/5] Added link to blog post --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 16f64754..2cafdcc9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # ember-in-viewport *Detect if an Ember View or Component is in the viewport @ 60FPS* +[Read the blogpost](https://medium.com/delightful-ui-for-ember-apps/creating-an-ember-cli-addon-detecting-ember-js-components-entering-or-leaving-the-viewport-7d95ceb4f5ed) + [![npm version](https://badge.fury.io/js/ember-in-viewport.svg)](http://badge.fury.io/js/ember-in-viewport) [![Build Status](https://travis-ci.org/dockyard/ember-in-viewport.svg)](https://travis-ci.org/dockyard/ember-in-viewport) This `ember-cli` addon adds a simple, highly performant Ember Mixin to your app. This mixin, when added to a `View` or `Component` (collectively referred to as `Components`), will allow you to check if that `Component` has entered the browser's viewport. By default, the Mixin uses the `requestAnimationFrame` API if it detects it in your user's browser – failing which, it fallsback to using the more resource heavy Ember run loop and event listeners. From 6e041a4366f42ef546b9c7fa6c2983eef84520f4 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 21 Apr 2015 00:14:56 -0400 Subject: [PATCH 2/5] Added LEGAL to readme --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 2cafdcc9..ec86daf0 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,11 @@ export default Ember.Component.extend(InViewportMixin, { * `ember build` For more information on using ember-cli, visit [http://www.ember-cli.com/](http://www.ember-cli.com/). + +## Legal + +[DockYard](http://dockyard.com), Inc © 2015 + +[@dockyard](http://twitter.com/dockyard) + +[Licensed under the MIT license](http://www.opensource.org/licenses/mit-license.php) From 5fedcecb40755331ff0bad7ce1c87ae8f50d4c09 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 21 Apr 2015 16:51:15 -0400 Subject: [PATCH 3/5] Minor formatting --- README.md | 2 -- addon/mixins/in-viewport.js | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ec86daf0..76ef95d6 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ This `ember-cli` addon adds a simple, highly performant Ember Mixin to your app. This mixin, when added to a `View` or `Component` (collectively referred to as `Components`), will allow you to check if that `Component` has entered the browser's viewport. By default, the Mixin uses the `requestAnimationFrame` API if it detects it in your user's browser – failing which, it fallsback to using the more resource heavy Ember run loop and event listeners. -This software will not be ready for production use until `1.0.0`. - ## Demo - App: http://development.ember-in-viewport-demo.divshot.io/ - Source: https://github.com/poteto/ember-in-viewport-demo diff --git a/addon/mixins/in-viewport.js b/addon/mixins/in-viewport.js index 3122436c..2a13efbe 100644 --- a/addon/mixins/in-viewport.js +++ b/addon/mixins/in-viewport.js @@ -79,7 +79,7 @@ export default Ember.Mixin.create({ } }, - _setViewportEntered(context=null) { + _setViewportEntered(context = null) { Ember.assert('You must pass a valid context to _setViewportEntered', context); const $viewportCachedEl = get(this, '$viewportCachedEl'); @@ -118,7 +118,7 @@ export default Ember.Mixin.create({ } }, - _setInitialViewport(context=null) { + _setInitialViewport(context = null) { Ember.assert('You must pass a valid context to _setInitialViewport', context); return scheduleOnce('afterRender', this, () => { @@ -126,7 +126,7 @@ export default Ember.Mixin.create({ }); }, - _scrollHandler(context=null) { + _scrollHandler(context = null) { Ember.assert('You must pass a valid context to _scrollHandler', context); const viewportRefreshRate = get(this, 'viewportRefreshRate'); @@ -136,7 +136,7 @@ export default Ember.Mixin.create({ }, viewportRefreshRate); }, - _bindListeners(context=null, event=null) { + _bindListeners(context = null, event = null) { Ember.assert('You must pass a valid context to _bindListeners', context); Ember.assert('You must pass a valid event to _bindListeners', event); From d91a22ab2fe0ec20e6ab4102d0286694d9bb5c5c Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 21 Apr 2015 16:53:12 -0400 Subject: [PATCH 4/5] Use const instead of let --- addon/utils/is-in-viewport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/utils/is-in-viewport.js b/addon/utils/is-in-viewport.js index 0208263c..13732622 100644 --- a/addon/utils/is-in-viewport.js +++ b/addon/utils/is-in-viewport.js @@ -12,7 +12,7 @@ const defaultTolerance = { export default function isInViewport(boundingClientRect={}, height=0, width=0, tolerance=defaultTolerance) { const { top, left, bottom, right } = boundingClientRect; const tolerances = merge(defaultTolerance, tolerance); - let { + const { top : topTolerance, left : leftTolerance, bottom : bottomTolerance, From b6c97a162197a29ae24d4cead0c299fd644b3fb9 Mon Sep 17 00:00:00 2001 From: Lauren Tan Date: Tue, 21 Apr 2015 16:54:03 -0400 Subject: [PATCH 5/5] Version bump to 1.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0b055bd..2cb3a364 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-in-viewport", - "version": "0.2.1", + "version": "1.0.0", "description": "Detect if an Ember View or Component is in the viewport @ 60FPS", "directories": { "doc": "doc",