Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fullscreen change event does not set isFullscreen #186

Closed
enjikaka opened this issue Feb 10, 2021 · 3 comments
Closed

Fullscreen change event does not set isFullscreen #186

enjikaka opened this issue Feb 10, 2021 · 3 comments

Comments

@enjikaka
Copy link

After going into fullscreen, in the callback onchange, getting isFullscreen returs undefined in v 5.1.0

@sindresorhus
Copy link
Owner

.isFullscreen literally cannot return undefined: https://github.com/sindresorhus/screenfull.js/blob/eddb5fc63d74b714edabe7829f5b0e007eb1689c/src/screenfull.js#L154-L158 There's something else going on.

@eliasbg
Copy link

eliasbg commented Jun 27, 2021

Hello,

I have the same problem.
the isFullscreen property does not exist.

import * as screenfull from 'screenfull';

export class AppComponent implements OnInit {
isFullScreen: boolean | undefined;
  
  ngOnInit() : void {
    if (screenfull.isEnabled) {
      screenfull.on('change', () => {
        this.isFullScreen = screenfull.isFullscreen;
      })
    }  
  }
}

Error: src/app/app.component.ts:16:40 - error TS2339: Property 'isFullscreen' does not exist on type 'Screenfull | { isEnabled: false; }'.
  Property 'isFullscreen' does not exist on type '{ isEnabled: false; }'.

16         this.isFullScreen = screenfull.isFullscreen;

@frontsomni
Copy link

@eliasbg

open screenfull.d.ts file

find screenfull declare (about 169 lines):

declare let screenfull: screenfull.Screenfull | {isEnabled: false};

fix:

declare let screenfull: screenfull.Screenfull;

you can access isFullscreen property

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants