aboutsummaryrefslogtreecommitdiff
path: root/src/content/presenters/ConsoleFramePresenter.ts
blob: 3c7477b9de1d9b8d59e7cc116149970f652ddaab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
export default interface ConsoleFramePresenter {
  initialize(): void;

  blur(): void;

  // eslint-disable-next-line semi
}

export class ConsoleFramePresenterImpl implements ConsoleFramePresenter {
  initialize(): void {
    let iframe = document.createElement('iframe');
    iframe.src = browser.runtime.getURL('build/console.html');
    iframe.id = 'vimvixen-console-frame';
    iframe.className = 'vimvixen-console-frame';
    document.body.append(iframe);
  }

  blur(): void {
    let ele = document.getElementById('vimvixen-console-frame');
    if (!ele) {
      throw new Error('console frame not created');
    }
    ele.blur();
  }
}