mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2025-02-17 05:27:52 +00:00
parent
e8c7b56292
commit
45b4d9f89f
@ -53,6 +53,11 @@ export const LifecycleForm = {
|
||||
" be different from that on a real device.")
|
||||
return FormState;
|
||||
},
|
||||
onShare: function (...args) {
|
||||
console.warn("LifecycleForm.onShare interface mocked in the Previewer. How this interface works on the Previewer may" +
|
||||
" be different from that on a real device.")
|
||||
return {"key": "unknow any"};
|
||||
},
|
||||
}
|
||||
export const LifecycleApp = {
|
||||
onShow: function () {
|
||||
|
@ -14,6 +14,7 @@
|
||||
*/
|
||||
|
||||
import { paramMock } from "../../utils"
|
||||
import { Caller } from "../ohos_application_Ability";
|
||||
import { ExtensionContextClass } from "./ExtensionContext"
|
||||
|
||||
export const ServiceExtensionContextClass = class ServiceExtensionContext extends ExtensionContextClass {
|
||||
@ -127,5 +128,12 @@ export const ServiceExtensionContextClass = class ServiceExtensionContext extend
|
||||
})
|
||||
}
|
||||
};
|
||||
this.startAbilityByCall = function (...args) {
|
||||
console.warn("ServiceExtensionContext.startAbilityByCall interface mocked in the Previewer." +
|
||||
" How this interface works on the Previewer may be different from that on a real device.")
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(Caller);
|
||||
})
|
||||
};
|
||||
}
|
||||
};
|
@ -107,6 +107,10 @@ export const AbilityClass = class Ability {
|
||||
" may be different from that on a real device.")
|
||||
return [paramMock.paramStringMock];
|
||||
};
|
||||
this.onMemoryLevel = function (...args) {
|
||||
console.warn("application.Ability.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
export function mockAbility() {
|
||||
|
@ -33,6 +33,11 @@ export const OnContinueResult = {
|
||||
REJECT: 1,
|
||||
MISMATCH: 2,
|
||||
}
|
||||
export const MemoryLevel = {
|
||||
MEMORY_LEVEL_MODERATE: 0,
|
||||
MEMORY_LEVEL_LOW: 1,
|
||||
MEMORY_LEVEL_CRITICAL: 2,
|
||||
}
|
||||
export const WindowMode = {
|
||||
WINDOW_MODE_UNDEFINED: 0,
|
||||
WINDOW_MODE_FULLSCREEN: 1,
|
||||
@ -46,6 +51,7 @@ export function mockAbilityConstant() {
|
||||
LaunchReason,
|
||||
LastExitReason,
|
||||
OnContinueResult,
|
||||
MemoryLevel,
|
||||
WindowMode
|
||||
}
|
||||
return AbilityConstant;
|
||||
|
@ -35,6 +35,10 @@ export function mockAbilityStage() {
|
||||
console.warn("application.AbilityStage.onConfigurationUpdated interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.onMemoryLevel = function (...args) {
|
||||
console.warn("application.AbilityStage.onMemoryLevel interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
}
|
||||
}
|
||||
return new AbilityStageClass();
|
||||
|
@ -57,6 +57,11 @@ export function mockFormExtension() {
|
||||
" may be different from that on a real device.")
|
||||
return FormState;
|
||||
};
|
||||
this.onShare = function (...args) {
|
||||
console.warn("application.formExtension.onShare interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return {"key": "unknow any"};
|
||||
};
|
||||
}
|
||||
}
|
||||
return new formExtensionClass();
|
||||
|
@ -35,7 +35,8 @@ export const FormError = {
|
||||
ERR_FORM_FA_NOT_INSTALLED: 20,
|
||||
ERR_SYSTEM_RESPONSES_FAILED: 30,
|
||||
ERR_FORM_DUPLICATE_ADDED: 31,
|
||||
ERR_IN_RECOVERY: 36
|
||||
ERR_IN_RECOVERY: 36,
|
||||
ERR_DISTRIBUTED_SCHEDULE_FAILED: 37
|
||||
}
|
||||
export function mockFormError() {
|
||||
const formError = {
|
||||
|
@ -214,6 +214,18 @@ export function mockFormHost() {
|
||||
});
|
||||
}
|
||||
},
|
||||
shareForm: function (...args) {
|
||||
console.warn('formHost.shareForm interface mocked in the Previewer. How this interface works on the' +
|
||||
' Previewer may be different from that on a real device.');
|
||||
const len = args.length;
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock);
|
||||
} else {
|
||||
return new Promise((resolve) => {
|
||||
resolve();
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
return formHost
|
||||
}
|
@ -59,11 +59,21 @@ export const FormParam = {
|
||||
MODULE_NAME_KEY: "ohos.extra.param.key.module_name",
|
||||
WIDTH_KEY: "ohos.extra.param.key.form_width",
|
||||
HEIGHT_KEY: "ohos.extra.param.key.form_height",
|
||||
TEMPORARY_KEY: "ohos.extra.param.key.form_temporary"
|
||||
TEMPORARY_KEY: "ohos.extra.param.key.form_temporary",
|
||||
BUNDLE_NAME_KEY: "ohos.extra.param.key.bundle_name",
|
||||
ABILITY_NAME_KEY: "ohos.extra.param.key.ability_name",
|
||||
DEVICE_ID_KEY: "ohos.extra.param.key.device_id"
|
||||
}
|
||||
export const FormInfoFilter = {
|
||||
moduleName: '[PC preview] unknow moduleName',
|
||||
}
|
||||
export const FormDimension = {
|
||||
Dimension_1_2: 1,
|
||||
Dimension_2_2: '[PC preview] unknow Dimension_2_2',
|
||||
Dimension_2_4: '[PC preview] unknow Dimension_2_4',
|
||||
Dimension_4_4: '[PC preview] unknow Dimension_4_4',
|
||||
Dimension_2_1: '[PC preview] unknow Dimension_2_1',
|
||||
}
|
||||
export function mockFormInfo() {
|
||||
const formInfo = {
|
||||
FormInfo,
|
||||
@ -72,7 +82,8 @@ export function mockFormInfo() {
|
||||
FormStateInfo,
|
||||
FormState,
|
||||
FormParam,
|
||||
FormInfoFilter
|
||||
FormInfoFilter,
|
||||
FormDimension
|
||||
}
|
||||
return formInfo;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user