@dcloudio/uni-mp-toutiao 3.0.0-alpha-3030320211225001 → 3.0.0-alpha-3030420211228001

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.
Files changed (2) hide show
  1. package/dist/uni.mp.esm.js +20 -2
  2. package/package.json +6 -6
@@ -185,6 +185,12 @@ class EventChannel {
185
185
  }
186
186
  }
187
187
 
188
+ const MINI_PROGRAM_PAGE_RUNTIME_HOOKS = {
189
+ onPageScroll: 1,
190
+ onShareAppMessage: 1 << 1,
191
+ onShareTimeline: 1 << 2,
192
+ };
193
+
188
194
  const eventChannels = {};
189
195
  const eventChannelStack = [];
190
196
  function getEventChannel(id) {
@@ -290,7 +296,7 @@ function callHook(name, args) {
290
296
  return hooks && invokeArrayFns(hooks, args);
291
297
  }
292
298
 
293
- const PAGE_HOOKS = [
299
+ const PAGE_INIT_HOOKS = [
294
300
  ON_LOAD,
295
301
  ON_SHOW,
296
302
  ON_HIDE,
@@ -340,6 +346,17 @@ function initHooks(mpOptions, hooks, excludes = EXCLUDE_HOOKS) {
340
346
  }
341
347
  function initUnknownHooks(mpOptions, vueOptions, excludes = EXCLUDE_HOOKS) {
342
348
  findHooks(vueOptions).forEach((hook) => initHook$1(mpOptions, hook, excludes));
349
+ }
350
+ function initRuntimeHooks(mpOptions, runtimeHooks) {
351
+ if (!runtimeHooks) {
352
+ return;
353
+ }
354
+ const hooks = Object.keys(MINI_PROGRAM_PAGE_RUNTIME_HOOKS);
355
+ hooks.forEach((hook) => {
356
+ if (runtimeHooks & MINI_PROGRAM_PAGE_RUNTIME_HOOKS[hook]) {
357
+ initHook$1(mpOptions, hook, []);
358
+ }
359
+ });
343
360
  }
344
361
 
345
362
  tt.appLaunchHooks = [];
@@ -848,8 +865,9 @@ function parsePage(vueOptions, parseOptions) {
848
865
  };
849
866
  return this.$vm && this.$vm.$callHook(ON_LOAD, query);
850
867
  };
851
- initHooks(methods, PAGE_HOOKS);
868
+ initHooks(methods, PAGE_INIT_HOOKS);
852
869
  initUnknownHooks(methods, vueOptions);
870
+ initRuntimeHooks(methods, vueOptions.__runtimeHooks);
853
871
  parse && parse(miniProgramPageOptions, { handleLink });
854
872
  return miniProgramPageOptions;
855
873
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-mp-toutiao",
3
- "version": "3.0.0-alpha-3030320211225001",
3
+ "version": "3.0.0-alpha-3030420211228001",
4
4
  "description": "uni-app mp-toutiao",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -22,11 +22,11 @@
22
22
  },
23
23
  "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
24
24
  "dependencies": {
25
- "@dcloudio/uni-cli-shared": "3.0.0-alpha-3030320211225001",
26
- "@dcloudio/uni-mp-compiler": "3.0.0-alpha-3030320211225001",
27
- "@dcloudio/uni-mp-vite": "3.0.0-alpha-3030320211225001",
28
- "@dcloudio/uni-mp-vue": "3.0.0-alpha-3030320211225001",
29
- "@dcloudio/uni-shared": "3.0.0-alpha-3030320211225001",
25
+ "@dcloudio/uni-cli-shared": "3.0.0-alpha-3030420211228001",
26
+ "@dcloudio/uni-mp-compiler": "3.0.0-alpha-3030420211228001",
27
+ "@dcloudio/uni-mp-vite": "3.0.0-alpha-3030420211228001",
28
+ "@dcloudio/uni-mp-vue": "3.0.0-alpha-3030420211228001",
29
+ "@dcloudio/uni-shared": "3.0.0-alpha-3030420211228001",
30
30
  "@vue/compiler-core": "3.2.26"
31
31
  }
32
32
  }