Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
} catch ( postsFail ) {
dispatch( receivePosts( [] ) );
console.error( postsFail );
}
} );
} );
request.on( 'error', ( requestError ) => {
// eslint-disable-next-line no-console
console.error( `problem with request: ${ requestError.message }` );
} );
request.end();
};
const debouncedFetchPosts = debounce( getPosts, FETCH_DEBOUNCE_INTERVAL );
const fetchPosts = function fetchPosts ( state ) {
const {
search,
groups,
services,
} = state;
return ( dispatch ) => {
debouncedFetchPosts( search, groups, services, dispatch );
};
};
const fetchPostsImmediate = function fetchPostsImmediate ( state ) {
const {
search,
constructor(...args) {
super(...args);
this.mounted = false;
this.handleResize = debounce(() => {
// Skip configuration where the position is screen size invariant.
if (this.props.in || this.props.direction === 'down' || this.props.direction === 'right') {
return;
}
if (this.transitionRef) {
setTranslateValue(this.props, this.transitionRef);
}
}, 166);
this.handleEnter = node => {
setTranslateValue(this.props, node);
reflow(node);
if (this.props.onEnter) {
this.props.onEnter(node);
export function trackScrolling() {
const debouncedUserActivity = debounce(() => trackUserActivity(), 250, /* trailing: */ false);
const handleScrollUpdate = () => {
debouncedUserActivity();
};
window.addEventListener("scroll", handleScrollUpdate);
}
this.state = { isCollapseVisible: true, collapsed: true, maxHeight: 'auto' }
this.wrapper = React.createRef()
}
calcMaxHeight = () => {
const { collapseHeight } = this.props
const wrapper = this.wrapper.current
if (wrapper.scrollHeight > collapseHeight) {
const maxHeight = wrapper.scrollHeight + 60
this.setState({ isCollapseVisible: true, maxHeight })
} else this.setState({ isCollapseVisible: false, maxHeight: 'auto' })
}
debouncedCalcMaxHeight = debounce(this.calcMaxHeight, 500)
componentDidMount() {
window.addEventListener('resize', this.debouncedCalcMaxHeight)
this.calcMaxHeight()
}
componentWillUnmount() {
window.removeEventListener('resize', this.debouncedCalcMaxHeight)
}
render() {
const { children, collapseHeight } = this.props
const { collapsed, isCollapseVisible, maxHeight } = this.state
const height = isCollapseVisible && collapsed ? collapseHeight : maxHeight
const transitionTime = 600
const fadeOutTime = 400
awebooking.dialog = function (selector) {
const $dialog = $(selector).dialog({
modal: true,
width: 'auto',
height: 'auto',
autoOpen: false,
draggable: false,
resizable: false,
closeOnEscape: true,
dialogClass: 'wp-dialog awebooking-dialog',
position: { my: 'center', at: 'center center-15%', of: window },
})
$(window).on('resize', debounce(() => {
$dialog.dialog('option', 'position', { my: 'center', at: 'center center-15%', of: window })
}, 150))
return $dialog
}
created() {
this.fetchUserData();
this.clearSuccessMessage = debounce(this.clearSuccessMessage, debounceMilliseconds);
},
<span>
<span>
{light.name}
</span>
</span>
)
}
}
_registerMediaQueryListeners() {
this._onMediaChange = debounce(this.onMediaQueryChange.bind(this), 50);
Object.keys(BaseComponent.queries).forEach((k) => {
BaseComponent.queries[k].addListener(this._onMediaChange);
});
}
return () => {
const {debounceReconciler} = instance.props;
instance.reconcileFrameAfterUpdate = isNumber(debounceReconciler)
? debounce((updateFrame) => {
updateFrame();
}, debounceReconciler)
: raf;
};
};
$from.datepicker({
autoclose: true,
container: '#datepickersContainer',
});
$to.datepicker({
autoclose: true,
container: '#datepickersContainer',
useCurrent: false,
});
showDatepickers.set(fromTime || toTime);
this.find('input').focus();
});
const debounceSubscription = debounce( ( instance, fromTime, toTime )=> {
instance.subscribe('resourcesSearch', Session.get('currentOrgId'), getStoredQ(), displayLimit.get(), fromTime, toTime);
}, 500);
Template.page_resources.onCreated(function() {
this.autorun(() => {
var urlQ = FlowRouter.getQueryParam('q') || '';
var urlLimit = parseInt(FlowRouter.getQueryParam('limit') || 0);
if (urlQ && getStoredQ != urlQ) {
setStoredQ(urlQ);
}
if (urlLimit && displayLimit.get() != urlLimit) {
displayLimit.set(urlLimit);
return;
}