I've trying to study with Javascript design patterns to improve my practice but I simply confused with all kind of those patterns special I found a style which was used in facebook script (study) it simple and may be easy to use if I've much understand about those design patterns so I would like to ask all expert here about the kind of patterns that facebook used with the Javascript library (react js)as below code
__d('StaticUFI.react',
['getElementPosition', 'getElementRect', 'getUnboundedScrollPosition',
'shallowEqual', 'throttle'],
function a(b, c, d, e, f, g, h, i) {
'use strict';
var j = c('UFIConstants').UFIFeedbackSourceType,
k = c('UFIConstants').UFIStatus,
l = c('React').PropTypes,
m = c('React').createElement('div', {className: "UFICommentsLoadingSpinnerContainer _48pi UFIRow"},
c('React').createElement(c('XUISpinner.react'), {size: 'large'})),
n = c('React').createElement('div', {
className: "_xtv",
role: 'presentation'
}, c('React').createElement('i', null)), o = c('React').createClass({
displayName: 'StaticUFI',
contextTypes: {dispatch: l.func},
getInitialState: function () {
var p = this.props.focusReply;
return {focusReply: p, viewerHasClickedCommentComposer: false, viewerHasClickedSeeMore: false};
},
getDefaultProps: function () {
return {
commentIDToFocusOnMount: null,
focusReply: null,
canReplyMap: {},
isActiveLoading: {},
repliesExpandedMap: {},
hasPagedToplevel: false,
viewerHasInteractedWithComments: false,
loadingSpamIDs: {}
};
},
componentDidMount: function () {
c('Arbiter').inform('UFI/displayDone-' + this.props.contextArgs.instanceid);
if (this.props.feedback.isqanda && this.props.feedback.infinitescroll) {
var p = c('throttle')(this.loadMoreComments, 20);
this._scrollEventListener = c('Event').listen(window, 'scroll', p);
this._resizeEventListener = c('Event').listen(window, 'resize', p);
}
if (c('BlueBar').hasFixedBlueBar())this.setState({oldBoundingClientRect: c('getElementRect')(c('ReactDOM').findDOMNode(this))});
this._resolveFocus();
},
loadMoreComments: function () {
if (this.isMounted() && this.refs.topLevelBottomPager && !(this.props.contextArgs.ftentidentifier in this.props.isActiveLoading)) {
var p = c('ReactDOM').findDOMNode(this.refs.topLevelBottomPager),
q = c('getUnboundedScrollPosition')(window).y,
r = q + document.documentElement.clientHeight + c('UFIConstants').infiniteScrollRangeForQANDAPermalinks;
if (p.offsetHeight && p.offsetTop < r)this.refs.topLevelBottomPager.props.onPagerClick();
}
}
});
f.exports = o;
}, null);
Aucun commentaire:
Enregistrer un commentaire