Skip to content

Instantly share code, notes, and snippets.

Avatar

Evan You yyx990803

View GitHub Profile
View async_asap.html
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
body {
font-family: 'Helvetica Neue', Arial, 'Microsoft Yahei', sans-serif;
padding: 0 30px;
color: #333;
@yyx990803
yyx990803 / 之乎者也.md
Last active Apr 21, 2020
之乎者也,一个文言风的类JS玩具语言
View 之乎者也.md
斐波那契者 得甲
 閱甲
    零乎
      零是也
    壹乎
      壹是也
    它者乎
      前者 甲 壹 差之 遞歸之也
      前前者 甲 貳 差之 遞歸之也
@yyx990803
yyx990803 / frameworks.md
Created Dec 3, 2012
国内互联网公司的前端框架简介
View frameworks.md

百度:Tangram

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

腾讯:JX

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

View reverting-to-microtask.md

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
View App.vue
<template>
<div class="jumbotron">
<div class="row">
<div class="col-md-6">
<h1>Vue.js 3.0.0-alpha4 (keyed)</h1>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-sm-6 smallpad">
<button type="button" class="btn btn-primary btn-block" id="run" @click="run">Create 1,000 rows</button>
@yyx990803
yyx990803 / svelte.js
Last active Dec 8, 2019
Svelte/Vue generated code size comparison of the TodoMVC implementation. Note: (1) imports are replaced with a const declaration to enable compression. (2) The comparison is between components' "own code" and doesn't include imported runtime code.
View svelte.js
/* App.svelte generated by Svelte v3.14.1 */
/* After terser compression: min:6.00kb / gzip:2.43kb / brotli:2.15kb */
const {
SvelteComponent,
append,
attr,
destroy_block,
detach,
element,
empty,
View full-reactivity-render.html
<div id="app"></div>
<script>
// fileA.js
let currentEffect
class Dep {
constructor() {
this.subscribers = new Set()
}
@yyx990803
yyx990803 / async.js
Created Aug 8, 2014
Simple helper for async tests in Jasmine 1.3 that mimics 2.0 and Mocha
View async.js
/**
* Jasmine 1.3 async helper
*/
function async (run) {
return function () {
var done = false
waitsFor(function () { return done })
run(function () { done = true })
}
View 2.6-scoped-slot-return-values.md

2.6 Internal Change: Scoped Slot Function Return Value

This change only affects render function users. If you only use templates, you can ignore this change.

The Problem

In render functions, scoped slots are exposed on this.$scopedSlots as functions. Up until now, calling a scoped slot function can return a single VNode or an Array of VNodes based on what the parent component is passing in. For example, given this component:

const Child = {
View async-error.js
export default {
async mounted() {
// if an async error is thrown here, it now will get
// caught by errorCaptured and Vue.config.errorHandler
this.posts = await api.getPosts()
}
}