Releases: DockYard/ember-in-viewport
Updated ember-cli
This release updates ember-cli to 0.2.4, so we use a new version of ember. ember-suave was also updated.
There are no other changes.
Options fix
Better butter
This release contains a few bug fixes for #15 and #16, as well as a general formatting cleanup from adding ember-suave
to the addon.
Changelog
#14 Enforce style guide by @poteto
#17 [BUGFIX] Set viewportEntered
before triggering hook by @poteto
#18 [BUGFIX] Default value for viewportConfig
in initializer by @poteto
Configure all the things!
This release adds 2 features:
-
didScroll{Up,Down,Left,Right}
hooksYou can now subscribe to
didScroll{Up,Down,Left,Right}
hooks that are
emitted by the Mixin when the element enters the viewport. This is primarily
for the purposes of replacing thewaypoints
library inember-waypoints
to
use an Ember implementation instead.As with any other hook in Ember, you can handle it with:
export default Ember.Component.extend(InViewportMixin, { didScrollUp(direction) { console.log(direction); // 'up' }, didScrollDown(direction) { console.log(direction); // 'down' }, didScrollLeft(direction) { console.log(direction); // 'left' }, didScrollRight(direction) { console.log(direction); // 'right' } });
There is also a new
viewportScrollSensitivity
option that affects the above
behavior. -
Global options
You can set application wide defaults for
ember-in-viewport
in your app
(they are still manually overridable inside of a Component). To set new
defaults, just add a config object toconfig/environment.js
, like so:module.exports = function(environment) { var ENV = { // ... viewportConfig: { viewportSpy : false, viewportUseRAF : true, viewportScrollSensitivity : 1, viewportRefreshRate : 100, viewportListeners : [], viewportTolerance: { top : 0, left : 0, bottom : 0, right : 0 } } }; };
Changelog
#13 Application wide defaults by @poteto
#12 Guard against removed element
by @LevelbossMike
#11 waypoint hooks first draft by @poteto
Waypoint hooks
Install the beta and report if you have any issues.
$ ember install [email protected]
This pre-release adds a feature where you can now subscribe to didScroll{Up,Down,Left,Right}
hooks that are emitted by the Mixin when the element enters the viewport. This is primarily for the purposes of replacing the waypoints
library in ember-waypoints
to use an Ember implementation instead.
As with any other hook in Ember, you can handle it with:
export default Ember.Component.extend(InViewportMixin, {
didScrollUp() {
console.log('up');
},
didScrollDown() {
console.log('down');
},
didScrollLeft() {
console.log('left');
},
didScrollRight() {
console.log('right');
}
});
Changelog
Actual hooks
With this release, you no longer need to use observers on viewportEntered
in your app. The Mixin now emits actual events that you can handle like you would any other native Ember hook:
export default Ember.Component.extend(InViewportMixin, {
// with prototype extensions disabled
handleDidEnterViewport: Ember.on('didEnterViewport', function() {
console.log('entered');
}),
handleDidExitViewport: Ember.on('didExitViewport', function() {
console.log('exited');
}),
// with prototype extensions enabled
handleDidEnterViewport: (function() {
console.log('entered');
}).on('didEnterViewport'),
handleDidExitViewport: (function() {
console.log('exited');
}).on('didExitViewport'),
// method override
didEnterViewport() {
console.log('entered');
},
didExitViewport() {
console.log('exited');
}
});
Changelog:
#8 Refactor and Evented hooks by @poteto (thanks to @rwjblue for reporting)
Stable API
This release is a simple version bump to 1.0.0
to mark API stability and commitment to SemVer.
Bugfix for top and left tolerance
This release fixes a bug where the top and left tolerances were being incorrectly calculated.
Beta release
This release is the first beta release for ember-in-viewport
– the addon is now at a feature complete state and is ready to be tested in your production apps or side projects. Please help out by opening issues if you encounter any problems!