vue.js 源代码学习笔记 ----- Dep】的更多相关文章

/* @flow */ import type Watcher from './watcher' import { remove } from '../util/index' let uid = 0 /** * A dep is an observable that can have multiple * directives subscribing to it. 一个订阅模式 可以有多个指令去订阅他 */ export default class Dep { static target: ?W…
/** * Not type-checking this file because it's mostly vendor code. */ /*! * HTML Parser By John Resig (ejohn.org) * Modified by Juriy "kangax" Zaytsev * Original code by Erik Arvidsson, Mozilla Public License * http://erik.eae.net/simplehtmlpars…
/* @flow */ import Dep from '../observer/dep' import Watcher from '../observer/watcher' import { set, del, observe, observerState, defineReactive } from '../observer/index' import { warn, bind, noop, hasOwn, isReserved, handleError, validateProp, isP…
/* @flow */ import Vue from '../instance/index' import config from '../config' import { warn } from './debug' import { set } from '../observer/index' import { extend, isPlainObject, hasOwn, camelize, capitalize, isBuiltInTag } from 'shared/util' /**…
/* @flow */ // Object.freeze 使得这个对象不能增加属性, 修改属性, 这样就保证了这个对象在任何时候都是空的 export const emptyObject = Object.freeze({}) /** * Check if a string starts with $ or _ ascii unicode 的区别 charcodeAt是一个字符的 unicode编码, 但是像 0x24 (代表的是 $ ) 0x5f (代表的是 _ ) 因为是字符, 先存着asc…
/* @flow */ /* globals MutationObserver */ import { noop } from 'shared/util' // can we use __proto__? 有些浏览器不能让你明目张胆的使用 __proto__ export const hasProto = '__proto__' in {} // Browser environment sniffing 这里作者不太严谨, 直接用 navigator.userAget 判断浏览器 //利用 wi…
参考 vue 2.2.6版本 /* @flow */ //引入订阅者模式 import Dep from './dep' import { arrayMethods } from './array' import { def, isObject, isPlainObject, hasProto, hasOwn, warn, isServerRendering } from '../util/index' const arrayKeys = Object.getOwnPropertyNames(a…
/* @flow */ import { parseFilters } from './parser/filter-parser' export function baseWarn (msg: string) { console.error(`[Vue parser]: ${msg}`) } export function pluckModuleFunction ( modules: ?Array<Object>, key: string ): Array<Function> {…
/* @flow */ import { warn, nextTick, toNumber, _toString, looseEqual, emptyObject, handleError, looseIndexOf } from '../util/index' import VNode, { cloneVNodes, createTextVNode, createEmptyVNode } from '../vdom/vnode' import { createElement } from '.…
/* @flow */ import { updateListeners } from '../vdom/helpers/index' import { toArray, tip, hyphenate, formatComponentName } from '../util/index' export function initEvents (vm: Component) { vm._events = Object.create(null) vm._hasHookEvent = false //…