Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #74 from brave/audio-indicator-mute-tab
Browse files Browse the repository at this point in the history
Remove AppStore access directly from AppActions
  • Loading branch information
bbondy committed Dec 20, 2015
2 parents 2b36b9b + 0f55676 commit 91d70b1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
11 changes: 8 additions & 3 deletions js/actions/appActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const AppDispatcher = require('../dispatcher/appDispatcher')
const AppConstants = require('../constants/appConstants')
const Config = require('../constants/config')
const UrlUtil = require('../../node_modules/urlutil.js/dist/node-urlutil.js')
const AppStore = require('../stores/appStore')
const ipc = global.require('electron').ipcRenderer
const messages = require('../constants/messages')

Expand Down Expand Up @@ -139,8 +138,14 @@ const AppActions = {
ipc.send(messages.NEW_WINDOW)
},

closeFrame: function (frameProps) {
if (AppStore.getFrameCount() > 1) {
/**
* Dispatches a message to close a frame
*
* @param {Object[]} frames - Immutable list of of all the frames
* @param {Object} frameProps - The properties of the frame to close
*/
closeFrame: function (frames, frameProps) {
if (frames.size > 1) {
AppDispatcher.dispatch({
actionType: AppConstants.APP_CLOSE_FRAME,
frameProps
Expand Down
4 changes: 2 additions & 2 deletions js/components/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ class Main extends ImmutableComponent {
})

ipc.on(messages.SHORTCUT_CLOSE_FRAME, (e, i) => typeof i !== 'undefined'
? AppActions.closeFrame(FrameStateUtil.getFrameByKey(self.props.browser, i))
: AppActions.closeFrame())
? AppActions.closeFrame(self.props.browser.get('frames'), FrameStateUtil.getFrameByKey(self.props.browser, i))
: AppActions.closeFrame(self.props.browser.get('frames')))
ipc.on(messages.SHORTCUT_UNDO_CLOSED_FRAME, () => AppActions.undoClosedFrame())

const self = this
Expand Down
3 changes: 2 additions & 1 deletion js/components/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Tab extends ImmutableComponent {
}

onCloseFrame () {
AppActions.closeFrame(this.props.frameProps)
AppActions.closeFrame(this.props.frames, this.props.frameProps)
}

onMuteFrame (muted) {
Expand Down Expand Up @@ -223,6 +223,7 @@ class Tabs extends ImmutableComponent {
frames.map(frameProps => <Tab
activeDraggedTab={this.props.tabs.get('activeDraggedTab')}
frameProps={frameProps}
frames={this.props.frames}
key={'tab-' + frameProps.get('key')}
isActive={this.props.activeFrame === frameProps}
isPrivate={frameProps.get('isPrivate')}
Expand Down

0 comments on commit 91d70b1

Please sign in to comment.