Skip to content

Instantly share code, notes, and snippets.

const getDownloadItems = (state) => {
const isPrivate = state.get('currentWindow')
.get('frames')
.get('0')
.get('isPrivate')
if (!isPrivate) {
if (!state || !state.get('downloads')) {
return Immutable.List()
}
const getDownloadItems = (state) => {
const currentWindow = state.get('currentWindow')
const tabId = frameStateUtil.getActiveFrameTabId(state)
const frameKey = frameStateUtil.getFrameKeyByTabId(currentWindow, tabId)
const isPrivate = privateState.isPrivateTab(state, frameKey)
if (!isPrivate) {
if (!state || !state.get('downloads')) {
return Immutable.List()
function getActiveFrameTabId (state) {
const activeFrame = getActiveFrame(state)
return activeFrame && activeFrame.get('tabId')
}
module.exports.isPrivateTab = (state, frameKey) => {
const frame = frameStateUtil.getFrameByKey(state, frameKey)
if (frame == null) {
return false
}
return !!frame.get('isPrivate')
}
const getDownloadItems = (state) => {
.....
}
mergeProps (state, ownProps) {
......
}
mergeProps (state, ownProps) {
const currentWindow = state.get('currentWindow')
const tabId = ownProps.tabId
const frameKey = frameStateUtil.getFrameKeyByTabId(currentWindow, tabId)
const props = {}
props.isPinned = tabState.isTabPinned(state, tabId)
props.showTabTitle = titleState.showTabTitle(currentWindow, frameKey)
....
module.exports.showTabTitle = (state, frameKey) => {
const frame = frameStateUtil.getFrameByKey(state, frameKey)
if (frame == null) {
return false
}
const isNewTabPage = frameStateUtil.frameLocationMatch(frame, 'about:newtab')
const isActive = frameStateUtil.isFrameKeyActive(state, frameKey)
const isPartition = partitionState.isPartitionTab(state, frameKey)
....
...
..
.
onShowDownloads () {
appActions.createTabRequested({
url: 'about:downloads'
})
windowActions.setDownloadsToolbarVisible(false)
}
props.downloads = downloadUtil.getDownloadItems(state) || Immutable.List()
const getDownloadItems = (state) => {
if (!state || !state.get('downloads')) {
return Immutable.List()
}
const downloadsSize = state.get('downloads').size
const downloadItemWidth = domUtil.getStyleConstants('download-item-width')
const downloadItemMargin = domUtil.getStyleConstants('download-item-margin')
const downloadBarPadding = domUtil.getStyleConstants('download-bar-padding')
const downloadBarButtons = domUtil.getStyleConstants('download-bar-buttons')