From 9489b9cc643b3231f9748979c7f59ee62deaa8f9 Mon Sep 17 00:00:00 2001
From: zhenyuWang <13641039885@163.com>
Date: Tue, 24 Sep 2024 13:19:48 +0800
Subject: [PATCH] =?UTF-8?q?refactor(getApp):=20=E7=A7=BB=E9=99=A4=20eventB?=
=?UTF-8?q?us?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pages/API/get-app/get-app.test.js | 4 ----
pages/API/get-app/get-app.uvue | 36 -------------------------------
2 files changed, 40 deletions(-)
diff --git a/pages/API/get-app/get-app.test.js b/pages/API/get-app/get-app.test.js
index 88dcc920..ef9dffd0 100644
--- a/pages/API/get-app/get-app.test.js
+++ b/pages/API/get-app/get-app.test.js
@@ -47,10 +47,6 @@ describe('getApp', () => {
expect(newLifeCycleNum - oldLifeCycleNum).toBe(100)
await page.callMethod('setLifeCycleNum', oldLifeCycleNum)
})
- it('eventBus', async () => {
- const res = await page.callMethod('checkEventBus')
- expect(res).toBe(true)
- })
it('getAndroidApplication', async () => {
const res = await page.callMethod('checkGetAndroidApplication')
expect(res).toBe(true)
diff --git a/pages/API/get-app/get-app.uvue b/pages/API/get-app/get-app.uvue
index bd31778c..e31a5df4 100644
--- a/pages/API/get-app/get-app.uvue
+++ b/pages/API/get-app/get-app.uvue
@@ -39,9 +39,6 @@
increase lifeCycleNum
lifeCycleNum: {{ lifeCycleNum }}
-
@@ -174,39 +171,6 @@
setLifeCycleNum(num : number) {
setLifeCycleNum(num)
},
- checkEventBus() : boolean {
- const app = getApp()
- let num = 0
- const fn1 = (args : any | null) => {
- console.log('fn1 triggred', args)
- num++
- }
- const fn2 = (args : any | null) => {
- console.log('fn2 triggred', args)
- num++
- }
- const fn3 = (args : any | null) => {
- console.log('fn3 triggred', args)
- num++
- }
-
- app.on('fn12', fn1)
- app.on('fn12', fn2)
- app.once('fn3', fn3)
-
- app.emit('fn12', { name: 'name' })
- app.emit('fn12', { age: 20 })
- app.off('fn12', fn1)
- app.emit('fn12', null)
-
- app.emit('fn3', { name: 'name' })
- app.emit('fn3', { age: 20 })
- app.emit('fn3', null)
-
- const res = num == 6
- console.log('check eventBus', res)
- return res
- },
checkGetAndroidApplication() : boolean {
const app = getApp()
const androidApplication = app.getAndroidApplication()
--
GitLab