npm @vueuse/core 4.0.0
v4.0.0

latest releases: 11.2.0, 11.1.0, 11.0.3...
3 years ago

🎉

Thanks!

@neelance @matias-capeletto @maxma241 @scottbedard
@darkxanter @anteriovieira @amrbashir @liaoliao666
@yangger6 @Demivan @iGalaxyz @sxzz @sibbng @Ericteen

New Features

Migration Guide

BREAKING CHANGE

useTransition - named transition presets are removed. Import them from TransitionPresets instead. #190
import { useTransition } from '@vueuse/core'

useTransition(baseNumber, {
  duration: 1000,
  transition: 'easeInOutCubic',
})

Changed to

import { useTransition, TransitionPresets } from '@vueuse/core'

useTransition(baseNumber, {
  duration: 1000,
  transition: TransitionPresets.easeInOutCubic,
})
asyncComputed - evaluating state is now passed through arguments instead of returning tuple
import { asyncComputed } from '@vueuse/core'

const [state, evaluating] = asyncComputed(async () => {}, {})

Changed to

import { asyncComputed } from '@vueuse/core'

const evaluating = ref(false)
const state = asyncComputed(async () => {}, {}, evaluating)
useEventListener - event target moved from 4th argument to first
import { useEventListener } from '@vueuse/core'

useEventListener('click', handler, undefined, document)

Changed to

import { useEventListener } from '@vueuse/core'

useEventListener(document, 'click', handler)
useRefHistory - `flush` now default to `pre`, returned `current` renamed to `source`, hisotry point `value` renamed to `snapshot`
Refer to docs for more details.
useWebWorkerFn - `workerStatus` changed from enum to literal unions
import { useWebWorkerFn, WorkStatus } from '@vueuse/core'

const { workerStatus } = useWebWorkerFn(fn)

workerStatus.value === WorkStatus.running

Changed to

import { useWebWorkerFn } from '@vueuse/core'

const { workerStatus } = useWebWorkerFn(fn)

workerStatus.value === 'RUNNING'
useNow - `useNow` renamed to `useTimestamp` with API changes
import { useNow } from '@vueuse/core'

const now = useNow()

Changed to

import { useTimestamp } from '@vueuse/core'

const { timestamp: now, pause, resume } = useTimestamp()
useRaf - dropped in favor of `useTimestamp`
None
useTimeout / useInterval - returned `activated` renamed to `isActive`
None
useRafFn - `start` / `stop` renamed to `resume` / `pause`
None
useXXXObserver - API changes

Refer to docs and types for more details.

Generated changelog

Bug Fixes

Features

Don't miss a new core release

NewReleases is sending notifications on new releases.