Skip to content

Commit

Permalink
feat: update useFullscreen utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoluoboding committed Jan 10, 2021
1 parent 65bf28d commit 09120cf
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import { ref } from 'vue-demi'
import { ref, Ref } from 'vue-demi'
import screenfull, { Screenfull } from 'screenfull'
import { tryOnMounted } from './useLifecycle'
import { tryOnMounted } from '../useLifecycle'
import { Fn } from '../utils'

export interface IFullScreen {
isFullscreen: Ref<boolean>;
toggleFullscreen: Fn;
}

/**
* Reactive Fullscreen API build on top of screenfull.js
* @param {HTMLElement} target
* @return {boolean} isFullscreen
* @return {function} toggle
* @return {function} toggleFullscreen
*/
const useFullscreen = (target: HTMLElement) => {
const useFullscreen = (target: HTMLElement): IFullScreen => {
const targetRef = ref(target || document.querySelector('html'))
const isFullscreen = ref(false)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getCurrentInstance, onMounted, onUnmounted, nextTick } from 'vue-demi'

import { Fn } from './utils'
import { Fn } from '../utils'

/**
* Call onMounted() if it's inside a component lifecycle, if not, run just call the function
Expand Down
File renamed without changes.

0 comments on commit 09120cf

Please sign in to comment.