Skip to content

Commit

Permalink
use subscribe-ui-event
Browse files Browse the repository at this point in the history
  • Loading branch information
kaesonho committed Aug 31, 2015
1 parent f3a2a21 commit c89d241
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 148 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
},
"dependencies": {
"debug": "^2.1.3",
"eventemitter3": "^1.0.0",
"hoist-non-react-statics": "^1.0.0",
"object-assign": "^4.0.0",
"promise": "^7.0.1",
"setimmediate": "^1.0.2"
"setimmediate": "^1.0.2",
"subscribe-ui-event": "^0.2.2"
},
"devDependencies": {
"coveralls": "^2.11.1",
Expand Down
2 changes: 1 addition & 1 deletion src/mixins/I13nMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ var I13nMixin = {
_recursiveDetectViewport: function () {
var self = this;
// detect viewport from the root, and skip all children's detection if it's not in the viewport
self._detectViewport(function detectCallback () {
self._detectViewport(null, null, function detectCallback () {
if (self._i13nNode.isInViewport()) {
self._i13nNode.getChildrenNodes().forEach(function detectChildrenViewport (childNode) {
var reactComponent = childNode.getReactComponent();
Expand Down
3 changes: 0 additions & 3 deletions src/mixins/viewport/EventEmitter.js

This file was deleted.

31 changes: 0 additions & 31 deletions src/mixins/viewport/MessageMixin.js

This file was deleted.

17 changes: 5 additions & 12 deletions src/mixins/viewport/ViewportMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@
'use strict';

var React = require('react/addons');

var MsgMixin = require('./MessageMixin');

if (typeof window !== 'undefined') {
require('./scroll');
require('./visibility');
}
var subscribe = require('subscribe-ui-event').subscribe;

/* Viewport mixin assumes you are on browser and already have the scroll lib */
var Viewport = {
mixins: [MsgMixin],


propTypes: {
viewport: React.PropTypes.shape({
margins: React.PropTypes.shape({
Expand Down Expand Up @@ -53,7 +46,7 @@ var Viewport = {
callback && callback();
},

_detectViewport: function (callback) {
_detectViewport: function (err, payload, callback) {
var self = this;
if (!self.isMounted()) {
return;
Expand All @@ -75,11 +68,11 @@ var Viewport = {
},

subscribeViewportEvents: function () {
this.subscribe('scroll', this._detectViewport);
this.subscription = subscribe('scroll', this._detectViewport);
},

unsubscribeViewportEvents: function () {
this.unsubscribe('scroll');
this.subscription.unsubscribe();
},

onEnterViewport: function (callback) {
Expand Down
36 changes: 0 additions & 36 deletions src/mixins/viewport/scroll.js

This file was deleted.

63 changes: 0 additions & 63 deletions src/mixins/viewport/visibility.js

This file was deleted.

0 comments on commit c89d241

Please sign in to comment.