rename to follow-controller
This commit is contained in:
		
							parent
							
								
									24c7369451
								
							
						
					
					
						commit
						2c600786c8
					
				
					 9 changed files with 107 additions and 106 deletions
				
			
		| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
import * as followActions from 'content/actions/follow';
 | 
			
		||||
import * as followControllerActions from 'content/actions/follow-controller';
 | 
			
		||||
import messages from 'shared/messages';
 | 
			
		||||
import HintKeyProducer from 'content/hint-key-producer';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -28,7 +28,8 @@ export default class FollowController {
 | 
			
		|||
  onMessage(message, sender) {
 | 
			
		||||
    switch (message.type) {
 | 
			
		||||
    case messages.FOLLOW_START:
 | 
			
		||||
      return this.store.dispatch(followActions.enable(message.newTab));
 | 
			
		||||
      return this.store.dispatch(
 | 
			
		||||
        followControllerActions.enable(message.newTab));
 | 
			
		||||
    case messages.FOLLOW_RESPONSE_COUNT_TARGETS:
 | 
			
		||||
      return this.create(message.count, sender);
 | 
			
		||||
    case messages.FOLLOW_KEY_PRESS:
 | 
			
		||||
| 
						 | 
				
			
			@ -38,7 +39,7 @@ export default class FollowController {
 | 
			
		|||
 | 
			
		||||
  update() {
 | 
			
		||||
    let prevState = this.state;
 | 
			
		||||
    this.state = this.store.getState().follow;
 | 
			
		||||
    this.state = this.store.getState().followController;
 | 
			
		||||
 | 
			
		||||
    if (!prevState.enabled && this.state.enabled) {
 | 
			
		||||
      this.count();
 | 
			
		||||
| 
						 | 
				
			
			@ -53,7 +54,7 @@ export default class FollowController {
 | 
			
		|||
    let shown = this.keys.filter(key => key.startsWith(this.state.keys));
 | 
			
		||||
    if (shown.length === 1) {
 | 
			
		||||
      this.activate();
 | 
			
		||||
      this.store.dispatch(followActions.disable());
 | 
			
		||||
      this.store.dispatch(followControllerActions.disable());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    broadcastMessage(this.win, {
 | 
			
		||||
| 
						 | 
				
			
			@ -73,18 +74,18 @@ export default class FollowController {
 | 
			
		|||
    switch (key) {
 | 
			
		||||
    case 'Enter':
 | 
			
		||||
      this.activate();
 | 
			
		||||
      this.store.dispatch(followActions.disable());
 | 
			
		||||
      this.store.dispatch(followControllerActions.disable());
 | 
			
		||||
      break;
 | 
			
		||||
    case 'Escape':
 | 
			
		||||
      this.store.dispatch(followActions.disable());
 | 
			
		||||
      this.store.dispatch(followControllerActions.disable());
 | 
			
		||||
      break;
 | 
			
		||||
    case 'Backspace':
 | 
			
		||||
    case 'Delete':
 | 
			
		||||
      this.store.dispatch(followActions.backspace());
 | 
			
		||||
      this.store.dispatch(followControllerActions.backspace());
 | 
			
		||||
      break;
 | 
			
		||||
    default:
 | 
			
		||||
      if (DEFAULT_HINT_CHARSET.includes(key)) {
 | 
			
		||||
        this.store.dispatch(followActions.keyPress(key));
 | 
			
		||||
        this.store.dispatch(followControllerActions.keyPress(key));
 | 
			
		||||
      }
 | 
			
		||||
      break;
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue