mirror of
https://github.com/openharmony/tools_previewer.git
synced 2026-08-27 00:31:14 -04:00
@@ -66,10 +66,12 @@ export function generateIndex(): string {
|
||||
indexBody += `export function mockRequireNapiFun() {
|
||||
global.requireNapi = function(...args) {
|
||||
const globalNapi = global.requireNapiPreview(...args);
|
||||
if (globalNapi !== undefined) {
|
||||
return globalNapi;
|
||||
}
|
||||
switch (args[0]) {`;
|
||||
if (globalNapi !== undefined) {\n\t`;
|
||||
indexBody += 'console.log(`${JSON.stringify(args)} called the dynamic library Api (${JSON.stringify(globalNapi)})`);\n';
|
||||
indexBody += `return globalNapi;
|
||||
}\n`;
|
||||
indexBody += 'console.log(`${JSON.stringify(args[0])} called the mockApi`);\n';
|
||||
indexBody += `switch (args[0]) {`;
|
||||
indexBody += caseBody;
|
||||
const endBody = `}
|
||||
if (global.hosMockFunc !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user