Skip to content

Instantly share code, notes, and snippets.

View yyx990803's full-sized avatar

Evan You yyx990803

View GitHub Profile

2.6 Internal Change: Reverting nextTick to Always Use Microtask

The Original Problem

When Vue detects data mutation, it asynchronously defer DOM updates to the next "tick" so that multiple mutations trigger only one update cycle. In versions before 2.5, Vue has been deferring updates using what is known as the "Microtask" (as explained in this blog post).

This works fine in most situations, but we discovered an edge case:

  1. Given two nested elements, "outer" and "inner";
  2. "inner" has a click event handler which triggers an update
@yyx990803
yyx990803 / nl.sh
Last active February 21, 2025 05:40
npm list only top level modules.
alias ng="npm list -g --depth=0 2>/dev/null"
alias nl="npm list --depth=0 2>/dev/null"
@yyx990803
yyx990803 / starcounter.js
Last active January 16, 2025 09:39
Count your total stars!
var https = require('https'),
user = process.argv[2],
opts = parseOpts(process.argv.slice(3))
request('/users/' + user, function (res) {
if (!res.public_repos) {
console.log(res.message)
return
}
var pages = Math.ceil(res.public_repos / 100),
@yyx990803
yyx990803 / repro.html
Created May 10, 2022 07:32
Weird detached element memory issue in Chrome
<div id="app">
<button id="reset">reset</button>
<button id="outer">no leak</button>
<div id="container">
<button id="inner">leak</button>
<span>1</span>
<span>2</span>
<span>3</span>
<span>4</span>
<span>5</span>
title date author gravatar twitter hidden
Vue 3 将成为新的默认版本
2022-01-20
尤雨溪
eca93da2c67aadafe35d477aa8f454b8
@youyuxi
true

划重点:Vue 3 将在 2022 年 2 月 7 日成为新的默认版本!

@yyx990803
yyx990803 / webpack.config.js
Last active March 8, 2024 17:43
vue-loader 15.0 usage
// This requires the WIP branch at https://github.com/vuejs/vue-loader/tree/next
const path = require('path')
const { VueLoaderPlugin } = require('vue-loader')
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './main.js'),
output: {
path: path.resolve(__dirname, 'dist')
@yyx990803
yyx990803 / 3.4.md
Last active December 29, 2023 16:42
[DRAFT] Vue 3.4 aggregated changelog

[DRAFT] 3.4.0 Aggregated Changelog

This is the aggregated changelog for 3.4 that includes changes landed in all alpha and beta pre-releases. For changelog of individual pre-releases, please check here.

Features

@yyx990803
yyx990803 / frameworks.md
Created December 3, 2012 21:52
国内互联网公司的前端框架简介

百度:Tangram

基本上就是个百度版jQuery,2.0版本使用链式API,更像了。
配套的还有UI库Magic和模版引擎BaiduTemplate(和ejs很像)

腾讯:JX

理念在介绍里面写的很详细,代码清晰,注释丰富,可读性很好,但只有文档没有实例。
比较传统的大块头框架,本质上来说还是一堆工具方法和对象的堆积,提供了很基本的模块化的开发方式,但没有模块间的依赖关系支持。

@yyx990803
yyx990803 / api.html
Last active May 19, 2023 23:17
连续请求ajax API回调顺序的问题
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script>
// coolshell api
function xss_ajax(url, callback) {
var script_id = null;
var script = document.createElement('script');
@yyx990803
yyx990803 / 3.3-changelog.md
Last active May 11, 2023 09:18
Vue 3.3 changelog

Note: this file is temporary - the main CHANGELOG.md is currently not viewable due to a GitHub bug. We will update all links to the main changelog once the bug is resolved.

3.3.1 (2023-05-11)

Bug Fixes

  • suspense: handle nested sync suspense for hydration (a3f5485)