Skip to content

Commit

Permalink
feat: deprecate refreshOnResize option (#211)
Browse files Browse the repository at this point in the history
  • Loading branch information
DamianGlowala committed Apr 19, 2024
1 parent d71086a commit 448143c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 7 additions & 1 deletion src/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defu } from 'defu'
import { defineNuxtModule, addPlugin, addImportsDir, createResolver } from '@nuxt/kit'
import { defineNuxtModule, addPlugin, addImportsDir, createResolver, useLogger } from '@nuxt/kit'
import { name, version } from '../package.json'
import type { ModuleOptions } from './types'

Expand All @@ -19,6 +19,12 @@ export default defineNuxtModule<ModuleOptions>({
refreshOnResize: false,
},
setup(options, nuxt) {
if (typeof options.refreshOnResize === 'boolean') {
const logger = useLogger('@nuxtjs/device')

logger.warn('\'refreshOnResize\' option is deprecated. It will be removed in the next major release.')
}

if (!options.enabled) {
return
}
Expand Down
6 changes: 2 additions & 4 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
export interface ModuleOptions {
/**
* Enable Device Module
* Whether to enable the module conditionally.
* @default true
* @type boolean
*/
enabled?: boolean

/**
* Device Module Default User Agent
* @default 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.39 Safari/537.36'
* @type string
*/
defaultUserAgent?: string

/**
* Refresh Device Module Values On Window Resize
* @default false
* @type boolean
* @deprecated
*/
refreshOnResize?: boolean
}
Expand Down

0 comments on commit 448143c

Please sign in to comment.