执行过npm install命令的vue-element-admin源码
康凯
2022-05-20 aa4c235a8ca67ea8b731f90c951a465e92c0a865
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
"use strict";
 
const EventInit = require("../generated/EventInit");
 
class EventImpl {
  constructor(args, privateData) {
    const [type, eventInitDict = this.constructor.defaultInit] = args;
 
    this.type = type;
 
    this.bubbles = false;
    this.cancelable = false;
    for (const key in eventInitDict) {
      if (key in this.constructor.defaultInit) {
        this[key] = eventInitDict[key];
      }
    }
    for (const key in this.constructor.defaultInit) {
      if (!(key in this)) {
        this[key] = this.constructor.defaultInit[key];
      }
    }
 
    this.target = null;
    this.currentTarget = null;
    this.eventPhase = 0;
 
    this._initializedFlag = true;
    this._stopPropagationFlag = false;
    this._stopImmediatePropagationFlag = false;
    this._canceledFlag = false;
    this._dispatchFlag = false;
 
    this.isTrusted = privateData.isTrusted || false;
    this.timeStamp = Date.now();
  }
 
  get srcElement() {
    return this.target;
  }
 
  get returnValue() {
    return !this._canceledFlag;
  }
 
  set returnValue(v) {
    if (this.cancelable && v === false) {
      this._canceledFlag = true;
    }
  }
 
  get defaultPrevented() {
    return this._canceledFlag;
  }
 
  stopPropagation() {
    this._stopPropagationFlag = true;
  }
 
  get cancelBubble() {
    return this._stopPropagationFlag;
  }
 
  set cancelBubble(v) {
    if (v) {
      this._stopPropagationFlag = true;
    }
  }
 
  stopImmediatePropagation() {
    this._stopPropagationFlag = true;
    this._stopImmediatePropagationFlag = true;
  }
 
  preventDefault() {
    if (this.cancelable) {
      this._canceledFlag = true;
    }
  }
 
  _initialize(type, bubbles, cancelable) {
    this.type = type;
    this._initializedFlag = true;
 
    this._stopPropagationFlag = false;
    this._stopImmediatePropagationFlag = false;
    this._canceledFlag = false;
 
    this.isTrusted = false;
    this.target = null;
    this.bubbles = bubbles;
    this.cancelable = cancelable;
  }
 
  initEvent(type, bubbles, cancelable) {
    if (this._dispatchFlag) {
      return;
    }
 
    this._initialize(type, bubbles, cancelable);
  }
}
EventImpl.defaultInit = EventInit.convert(undefined);
 
module.exports = {
  implementation: EventImpl
};