Files
third_party_jsframework/runtime/main/extend/systemplugin/napi/applicationAbility.js
T
liwenzhen f091ebdd72 update jsfw code for wgr
Signed-off-by: liwenzhen <liwenzhen3@huawei.com>
Change-Id: I0725e78ce0de746715f070f5cfa02ef90371afe7
2021-12-22 18:13:34 +08:00

55 lines
2.9 KiB
JavaScript

import { paramMock } from "../utils"
import { AbilityContextClass } from "./application/abilityContext"
const WantClass = class Want {
constructor() {
console.warn('Ability.Want.constructor interface mocked in the Previewer. How this interface works on' +
' the Previewer may be different from that on a real device.');
this.deviceId = "[PC Preview] unknow deviceId";
this.bundleName = "[PC Preview] unknow bundleName";
this.abilityName = "[PC Preview] unknow abilityName";
this.uri = "[PC Preview] unknow uri";
this.type = "[PC Preview] unknow type";
this.flag = "[PC Preview] unknow flag";
this.action = "[PC Preview] unknow action";
this.parameters = {};
this.entities = [paramMock.paramStringMock];
}
}
export function mockAbility() {
const AbilityClass = class Ability {
constructor() {
console.warn('application.Ability.constructor interface mocked in the Previewer. How this interface works on' +
' the Previewer may be different from that on a real device.');
this.context = new AbilityContextClass();
this.launchWant = new WantClass();
this.lastRequestWant = new WantClass();
this.onCreate = function (...args) {
console.warn("application.Ability.onCreate interface mocked in the Previewer. How this interface works on the Previewer" +
" may be different from that on a real device.")
};
this.onWindowStageCreate = function (...args) {
console.warn("application.Ability.onWindowStageCreate interface mocked in the Previewer. How this interface works on the Previewer" +
" may be different from that on a real device.")
};
this.onWindowStageDestroy = function () {
console.warn("application.Ability.onWindowStageDestroy interface mocked in the Previewer. How this interface works on the Previewer" +
" may be different from that on a real device.")
};
this.onDestroy = function () {
console.warn("application.Ability.onDestroy interface mocked in the Previewer. How this interface works on the Previewer" +
" may be different from that on a real device.")
};
this.onForeground = function () {
console.warn("application.Ability.onForeground interface mocked in the Previewer. How this interface works on the Previewer" +
" may be different from that on a real device.")
};
this.onBackground = function () {
console.warn("application.Ability.onBackground interface mocked in the Previewer. How this interface works on the Previewer" +
" may be different from that on a real device.")
};
}
}
return new AbilityClass();
}