Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// It can be initialised with optional parameters.
Ps.initialize(container, {
wheelSpeed: 2,
wheelPropagation: true,
minScrollbarLength: 20
})
// If the size of your container or content changes, call `update`.
Ps.update(container)
// If you want to destroy the scrollbar, use `destroy`.
Ps.destroy(container)
// If you want to scroll to somewhere, just use a `scrollTop` property and update.
container.scrollTop = 0
Ps.update(container)
/**
* https://github.com/noraesae/perfect-scrollbar#jquery
*/
import mountJQuery = require('perfect-scrollbar/jquery')
mountJQuery($)
$('#container').perfectScrollbar() // Initialize
$('#container').perfectScrollbar({ /*...*/ }) // with options
$('#container').perfectScrollbar('update') // Update
$('#container').perfectScrollbar('destroy') // Destroy
componentDidUpdate(prevProps, prevState) {
//reset scroll area in sidebar and betting widget upon route change.
Ps.update(this.refs.sidebar);
Ps.update(this.refs.main);
// navigate to new route after clicking confirm button in confirmation modal.
if (prevState.confirmToLeave === false && this.state.confirmToLeave === true) {
this.props.navigateTo(this.state.nextLocation);
this.setState({
confirmToLeave: false
});
}
}
_changeTab(tab) {
SettingsActions.changeViewSetting({
historyTab: tab
});
this.setState({
activeTab: tab
});
// Ensure that focus goes back to top of scrollable container when tab is changed
let historyNode = this.refs.history;
historyNode.scrollTop = 0;
Ps.update(historyNode);
setTimeout(ReactTooltip.rebuild, 1000);
}
const nodes = csv_export_container.childNodes;
let csv = "";
for (const n of nodes) {
//console.log("-- RecentTransactions._downloadCSV -->", n);
const cn = n.childNodes;
if (csv !== "") csv += "\n";
csv += [textContent(cn[0]), textContent(cn[1]), textContent(cn[2]), textContent(cn[3])].join(",");
}
var blob = new Blob([csv], { type: "text/csv;charset=utf-8" });
var today = new Date();
saveAs(blob, "gxbhist-" + today.getFullYear() + "-" + today.getMonth() + "-" + today.getDate() + ".csv");
}
if (!this.props.fullHeight) {
let t = this.refs.transactions;
ps.update(t);
this._setHeaderHeight();
}
}
psUpdate() {
if (!this.props.horizontal) {
Ps.update(this.verticalScrollBar());
} else {
let bidsContainer = this.refs.hor_bids;
Ps.update(bidsContainer);
let asksContainer = this.refs.hor_asks;
Ps.update(asksContainer);
}
}
if (
nextProps.hideScrollbars !== this.props.hideScrollbars &&
nextProps.hideScrollbars
) {
Ps.destroy(historyContainer);
}
if (
nextProps.hideScrollbars !== this.props.hideScrollbars &&
!nextProps.hideScrollbars
) {
Ps.initialize(historyContainer);
this.refs.historyTransition.resetAnimation();
if (historyContainer) historyContainer.scrollTop = 0;
Ps.update(historyContainer);
}
}
psUpdate() {
if (!this.props.horizontal) {
Ps.update(this.verticalScrollBar());
} else {
let bidsContainer = this.refs.hor_bids;
Ps.update(bidsContainer);
let asksContainer = this.refs.hor_asks;
Ps.update(asksContainer);
}
}
psUpdate() {
if (!this.props.horizontal) {
Ps.update(this.verticalScrollBar());
} else {
let bidsContainer = this.refs.hor_bids;
Ps.update(bidsContainer);
let asksContainer = this.refs.hor_asks;
Ps.update(asksContainer);
}
}
componentDidUpdate(prevProps) {
Ps.update(ReactDOM.findDOMNode(this.refs.bettingtable));
if (prevProps.betsError[0] !== this.props.betsError[0]) {
this.addRemoveMessage();
}
}
shouldComponentUpdate(nextProps, nextState) {
if (nextProps.activeTab !== this.state.activeTab) {
this._changeTab(nextProps.activeTab);
}
if (
this.props.hideScrollbars &&
nextState.showAll != this.state.showAll
) {
let contentContainer = this.refs.container;
if (!nextState.showAll) {
Ps.destroy(contentContainer);
} else {
Ps.initialize(contentContainer);
Ps.update(contentContainer);
}
if (this.refs.contentTransition) {
this.refs.contentTransition.resetAnimation();
}
if (contentContainer) contentContainer.scrollTop = 0;
}
return (
nextProps.baseSymbol !== this.props.baseSymbol ||
nextProps.quoteSymbol !== this.props.quoteSymbol ||
nextProps.className !== this.props.className ||
nextProps.activeTab !== this.props.activeTab ||
nextState.activeTab !== this.state.activeTab ||
nextState.showAll !== this.state.showAll ||
nextProps.currentAccount !== this.props.currentAccount
);