diff --git a/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/asynchronousfunctions.ets b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/asynchronousfunctions.ets index 7054a947b6fad4b2e7ce33be0fb5feaa21dbe366..c98d1ccdec0d992fe8e93730aca46ef76febfc1c 100755 --- a/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/asynchronousfunctions.ets +++ b/code/DocsSample/ArkTS/ArkTsConcurrent/MultithreadedConcurrency/TaskPoolIntroduction/entry/src/main/ets/managers/asynchronousfunctions.ets @@ -76,9 +76,9 @@ struct Index { .fontWeight(FontWeight.Bold) .onClick(() => { testConcurrentFunc(); - // [StartExclude update_message_on_success] + // [StartExclude concurrent_taskpool_async_promise_usage] this.message = 'success'; - // [EndExclude update_message_on_success] + // [EndExclude concurrent_taskpool_async_promise_usage] }) } .width('100%') @@ -86,71 +86,4 @@ struct Index { .height('100%') } } -// [End concurrent_taskpool_async_promise_usage] - - - - -import { BusinessError } from '@kit.BasicServicesKit'; - -// Start和Ende成对出现验证 -// [Start test-promise_async_operation] -const promise: Promise = new Promise((resolve: Function, reject: Function) => { - setTimeout(() => { - const randomNumber: number = Math.random(); - if (randomNumber > 0.5) { - resolve(randomNumber); - } else { - reject(new Error('Random number is too small')); - } - }, 1000); -}) -// [End promise_async_operation] - -promise.then((result: number) => { - console.info(`Random number is ${result}`); -}).catch((error: BusinessError) => { - console.error(error.message); -}); - -// StartExclude 和EndExclude成对出现验证 -// [Start test-async_await_sync_operation] -async function myAsyncFunction(): Promise { - const result: string = await new Promise((resolve: Function) => { - // [StartExclude test-timeout] - setTimeout(() => { - resolve('Hello, world!'); - }, 3000); - // [EndExclude timeout] - }); - console.info(result); // 输出: Hello, world! - return result; -} - -@Entry -@Component -struct PromiseAsyncAwait { - @State message: string = 'Hello World'; - - build() { - Row() { - Column() { - Text(this.message) - // StartExclude test-update_message_on_success - .fontSize(50) - .fontWeight(FontWeight.Bold) - // [EndExclude test-update_message_on_success] - .onClick(async () => { - let res = await myAsyncFunction(); - console.info('res is: ' + res); - // [StartExclude test1-update_message_on_success] - this.message = 'success'; - // EndExclude test1-update_message_on_success - }) - } - .width('100%') - } - .height('100%') - } -} -// [End test-async_await_sync_operation] +// [End concurrent_taskpool_async_promise_usage] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/JSVMAPI/JsvmProcess/entry/src/main/cpp/types/libentry/Index.d.ts b/code/DocsSample/ArkTs/JSVMAPI/JsvmProcess/entry/src/main/cpp/types/libentry/Index.d.ts index 42dfbbb7eab7317d1ce2f5d82d11ce9882a51af2..0368d3ca4666d9c8a3243c12d5cec2d801537e4e 100755 --- a/code/DocsSample/ArkTs/JSVMAPI/JsvmProcess/entry/src/main/cpp/types/libentry/Index.d.ts +++ b/code/DocsSample/ArkTs/JSVMAPI/JsvmProcess/entry/src/main/cpp/types/libentry/Index.d.ts @@ -15,4 +15,4 @@ // [Start export_native] export const runTest: () => void; -// [End export_native] +// [End export_native] \ No newline at end of file diff --git a/code/DocsSample/ArkTs/JSVMAPI/JsvmUsageGuide/UsageInstructionsTwo/getvm/src/main/cpp/hello.cpp b/code/DocsSample/ArkTs/JSVMAPI/JsvmUsageGuide/UsageInstructionsTwo/getvm/src/main/cpp/hello.cpp index fb75793a576945ebca659c63139b694456f49125..d2502f321fad27208472384358e29411ade57f1a 100755 --- a/code/DocsSample/ArkTs/JSVMAPI/JsvmUsageGuide/UsageInstructionsTwo/getvm/src/main/cpp/hello.cpp +++ b/code/DocsSample/ArkTs/JSVMAPI/JsvmUsageGuide/UsageInstructionsTwo/getvm/src/main/cpp/hello.cpp @@ -90,7 +90,7 @@ static JSVM_PropertyDescriptor descriptor[] = { }; const char *SRC_CALL_NATIVE = R"JS(getVM())JS"; -// [EndExclude oh_jsvm_get_vm] +// [End oh_jsvm_get_vm] static int32_t TestJSVM() {