Skip to content

Instantly share code, notes, and snippets.

View yyx990803's full-sized avatar

Evan You yyx990803

View GitHub Profile
@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 / starcounter.js
Last active March 8, 2024 08:36
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 / nl.sh
Last active March 5, 2024 01:24
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 / 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)
@yyx990803
yyx990803 / exampe-config.js
Created January 13, 2021 02:58
A vite plugin that loads the specified deps over CDN during dev, and downloads/includes them into bundle during build.
// example vite.config.js
import { cdn } from './vite-plugin-cdn'
export default {
plugins: [
// also supported: esm.run, jspm
// loads the dep over the CDN during dev
// auto downloads and includes into the bundle during build
cdn('skypack', {
vue: '^3.0.5'
// place this file in __mocks__
let pendingAssertions
exports.prompt = prompts => {
if (!pendingAssertions) {
throw new Error(`inquirer was mocked and used without pending assertions: ${prompts}`)
}
const answers = {}

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