@mpxjs/core 2.7.59 → 2.7.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.7.59",
3
+ "version": "2.7.62",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -42,5 +42,5 @@
42
42
  "url": "https://github.com/didi/mpx/issues"
43
43
  },
44
44
  "sideEffects": false,
45
- "gitHead": "92ab578c176f5c4439f40d2eb045b01e95a98038"
45
+ "gitHead": "c90b20b6693ca07385fe131aea7f484c19ba3b8c"
46
46
  }
@@ -2,13 +2,17 @@ export const BEFORECREATE = '__beforeCreate__'
2
2
  export const CREATED = '__created__'
3
3
  export const BEFOREMOUNT = '__beforeMount__'
4
4
  export const MOUNTED = '__mounted__'
5
+ export const BEFOREUPDATE = '__beforeUpdate__'
5
6
  export const UPDATED = '__updated__'
7
+ export const BEFOREUNMOUNT = '__beforeUnmount__'
6
8
  export const DESTROYED = '__destroyed__'
7
9
  export const INNER_LIFECYCLES = [
8
10
  BEFORECREATE,
9
11
  CREATED,
10
12
  BEFOREMOUNT,
11
13
  MOUNTED,
14
+ BEFOREUPDATE,
12
15
  UPDATED,
16
+ BEFOREUNMOUNT,
13
17
  DESTROYED
14
18
  ]
package/src/core/proxy.js CHANGED
@@ -28,7 +28,9 @@ import {
28
28
  CREATED,
29
29
  BEFOREMOUNT,
30
30
  MOUNTED,
31
+ BEFOREUPDATE,
31
32
  UPDATED,
33
+ BEFOREUNMOUNT,
32
34
  DESTROYED
33
35
  } from './innerLifecycle'
34
36
  import { warn, error } from '../helper/log'
@@ -124,11 +126,13 @@ export default class MPXProxy {
124
126
 
125
127
  updated () {
126
128
  if (this.isMounted()) {
129
+ this.callUserHook(BEFOREUPDATE)
127
130
  this.callUserHook(UPDATED)
128
131
  }
129
132
  }
130
133
 
131
134
  destroyed () {
135
+ this.callUserHook(BEFOREUNMOUNT)
132
136
  this.state = DESTROYED
133
137
  if (__mpx_mode__ !== 'web') {
134
138
  this.clearWatchers()
@@ -427,6 +431,7 @@ export default class MPXProxy {
427
431
  */
428
432
  let callback = cb
429
433
  if (this.isMounted()) {
434
+ this.callUserHook(BEFOREUPDATE)
430
435
  callback = () => {
431
436
  getRenderCallBack(this)()
432
437
  cb && cb()
package/src/index.js CHANGED
@@ -15,6 +15,18 @@ import { observe, set, del } from './observer/index'
15
15
  import { watch as watchWithVm } from './observer/watch'
16
16
  import implement from './core/implement'
17
17
 
18
+ export {
19
+ BEFORECREATE,
20
+ CREATED,
21
+ BEFOREMOUNT,
22
+ MOUNTED,
23
+ BEFOREUPDATE,
24
+ UPDATED,
25
+ BEFOREUNMOUNT,
26
+ DESTROYED,
27
+ DESTROYED as UNMOUNTED
28
+ } from './core/innerLifecycle'
29
+
18
30
  export function createApp (config, ...rest) {
19
31
  const mpx = new EXPORT_MPX()
20
32
  platform.createApp(Object.assign({ proto: mpx.proto }, config), ...rest)