Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuxt-viewport

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-viewport - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.0.5](https://github.com/mvrlin/nuxt-viewport/compare/v0.0.4...v0.0.5) (2021-06-17)
### Bug Fixes
* **runtime:** parse cookie and user-agent only if request headers available ([e755ab5](https://github.com/mvrlin/nuxt-viewport/commit/e755ab5897f79d36138b88bf0fac2f4b02f30708))
### [0.0.4](https://github.com/mvrlin/nuxt-viewport/compare/v0.0.3...v0.0.4) (2021-03-03)

@@ -7,0 +14,0 @@

15

lib/runtime/plugin.server.js

@@ -8,9 +8,16 @@ import cookie from 'cookie'

export default async function (ctx, inject) {
const { headers } = ctx.ssrContext.req
const options = <%= serialize(options) %>
const { req = {} } = ctx.ssrContext
const requestCookies = cookie.parse(headers.cookie || '')
const cookieViewport = requestCookies[options.cookieName]
let cookieViewport = ''
let requestCookies = {}
let userAgent = ''
const breakpoint = await detectBreakpoint.call(options, cookieViewport, headers['user-agent'])
if (req.headers) {
requestCookies = cookie.parse(req.headers.cookie || '')
cookieViewport = requestCookies[options.cookieName]
userAgent = req.headers['user-agent']
}
const breakpoint = await detectBreakpoint.call(options, cookieViewport, userAgent)
const viewport = useViewport(options, breakpoint)

@@ -17,0 +24,0 @@

{
"name": "nuxt-viewport",
"version": "0.0.4",
"version": "0.0.5",
"description": "Define custom viewports for your Nuxt project",

@@ -5,0 +5,0 @@ "keywords": [

@@ -60,8 +60,11 @@ # nuxt-viewport

```js
import { defineComponent, watch } from '@nuxtjs/composition-api'
import { defineComponent, useContext, watch } from '@nuxtjs/composition-api'
export default defineComponent({
setup(_, { root }) {
setup() {
// Context.
const context = useContext()
// Viewport module.
const viewport = root.$viewport
const viewport = context.$viewport

@@ -216,3 +219,3 @@ // Watch breakpoint for updates.

// Result: true.
$viewport.match('tablet', 'mobileWide')
$viewport.matches('tablet', 'mobileWide')
```

@@ -219,0 +222,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc