All Projects → vue-reactivity → scope

vue-reactivity / scope

Licence: MIT license
The auto effect collecting for @vue/reactivity

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to scope

fs
Reactive filesystem powered by @vue/reactivity
Stars: ✭ 45 (-26.23%)
Mutual labels:  vue3, vue-reactivity
miter-design
Miter Design component library made with ♡ by Prefect
Stars: ✭ 14 (-77.05%)
Mutual labels:  vue3
insta-share
Instant File Sharing powered by IPFS Networks. Build with Vue 3 and ViteJS
Stars: ✭ 53 (-13.11%)
Mutual labels:  vue3
vue3-chartjs
Vue3 wrapper for ChartJS
Stars: ✭ 122 (+100%)
Mutual labels:  vue3
chengpeiquan.com
My personal website. Base on Vite 2.0 and Vue 3.0. If you want to know how to use Vite to develop a project, you can refer to this repository.
Stars: ✭ 43 (-29.51%)
Mutual labels:  vue3
ECHI VUE TODO
使用 Vue 开发的一款 TODO 应用,包含登录、待办、日程、历史事项、回收站。项目较为小型,适合进阶学习使用(💡请注意,项目大量使用 jsx 进行开发)。
Stars: ✭ 19 (-68.85%)
Mutual labels:  vue3
myown
Blog 分享一些前端的知识,流行库的源码阅读,前端可做的性能优化,SVG动画小知识。
Stars: ✭ 64 (+4.92%)
Mutual labels:  vue3
flask-vue-project-seed
SPA quick start using Python Flask and Vue.js. Containerized with Docker.
Stars: ✭ 27 (-55.74%)
Mutual labels:  vue3
Admin-Frame-Vue3
基于Vue3 + Element-Plus + Vite 开发的中/后台管理系统
Stars: ✭ 181 (+196.72%)
Mutual labels:  vue3
fastadmin
vue3 + element-plus fast admin scaffold, 基于vue3和ElementPlus的中后台快速应用脚手架
Stars: ✭ 50 (-18.03%)
Mutual labels:  vue3
kendo-vue
Issue tracker - Kendo UI for Vue http://www.telerik.com/kendo-vue-ui/
Stars: ✭ 49 (-19.67%)
Mutual labels:  vue3
artemis
MateCloud前端代码,基于vue3、vite、pinia、ant-design vue实现的中台系统
Stars: ✭ 129 (+111.48%)
Mutual labels:  vue3
QuestionTime
📚 Quora-like Single Page Application built with Django, Django REST Framework and Vue JS
Stars: ✭ 76 (+24.59%)
Mutual labels:  vue3
jetstream-inertia-generator
Laravel 8 Admin CRUD generator built with Jetstream, Inertia js, Vue 3 and Tailwindcss 2
Stars: ✭ 105 (+72.13%)
Mutual labels:  vue3
vuse-rx
Vue 3 + rxjs = ❤
Stars: ✭ 52 (-14.75%)
Mutual labels:  vue3
inertiajs-tables-laravel-query-builder
Inertia.js Tables for Laravel Query Builder
Stars: ✭ 391 (+540.98%)
Mutual labels:  vue3
vue3-element-plus-im
vue3-element-plus-im vue3.0 element-plus vue-cli vue-router vuex composition-api axois websocket 即时聊天 前端vue 后端java springboot netty 即时通讯 chat
Stars: ✭ 93 (+52.46%)
Mutual labels:  vue3
vue-component-lib-starter
A bare-bones example of creating your own Vue component library.
Stars: ✭ 221 (+262.3%)
Mutual labels:  vue3
revue-draggable
A Vue component that makes anything draggable 🤏 Easy to use and control. Supports Vue3 and Vue2 🦾
Stars: ✭ 117 (+91.8%)
Mutual labels:  vue3
vue-virtualised
Blazing fast scrolling and updating for any amount of list and hierarchical data.
Stars: ✭ 18 (-70.49%)
Mutual labels:  vue3

The auto effect collecting for @vue/reactivity

npm npm bundle size

✳️ DEPRECATED: @vue/reactivity now ships effectScope builtin

Install

npm i @vue-reactivity/scope

Usage

Note: effectScope do NOT have equivalent in Vue. This package is designed to be used on non-Vue environment.

🥵 Collect and dispose manually

import { ref, computed, stop } from '@vue/reactivity'
import { watch, watchEffect } from '@vue-reactivity/watch'

const counter = ref(0)
let disposables = []

const doubled = computed(() => counter.value * 2)

const stopWatch = watch(doubled, () => console.log(double.value))

const stopWatchEffect = watchEffect(() => console.log('Count: ', double.value))

// manually collect effects
disposables.push(() => stop(doubled.effect))
disposables.push(stopWatch)
disposables.push(stopWatchEffect)

// to dispose all
disposables.forEach(d => d())
disposables = []

😎 With @vue-reactivity/scope

import { effectScope, ref, computed, watch, watchEffect, stop } from '@vue-reactivity/scope'

const counter = ref(0)

const scope = effectScope(() => {
  // computed, watch, watchEffect, effect ran inside the scope will be auto collected
  const doubled = computed(() => counter.value * 2)

  watch(doubled, () => console.log(double.value))

  watchEffect(() => console.log('Count: ', double.value))
})

// to dispose all effects
stop(scope)

This package redirects the APIs in @vue/reactivity and add some hook to them. You should always import APIs from @vue-reactivity/scope instead of @vue/reactivity.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].