Skip to content

Instantly share code, notes, and snippets.

View Spikef's full-sized avatar
🎯
Focusing

Spikef

🎯
Focusing
  • Hangzhou, Zhejiang, China
View GitHub Profile
@Spikef
Spikef / computed.js
Last active June 17, 2021 02:52
最基础的响应式原理实现。
const Watcher = require('./watcher');
class Computed extends Watcher {
constructor(vm, getter) {
super(vm, getter);
this.dirty = true;
}
get() {
if (this.dirty) {