From b3b6a2d0d2b6a7f78db5ee67da91fbd4320e089f Mon Sep 17 00:00:00 2001 From: VictoriaGuo Date: Sat, 25 Dec 2021 15:04:19 +0800 Subject: [PATCH] add raw file js api mock Signed-off-by: VictoriaGuo --- .../main/extend/systemplugin/resourceManager.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/runtime/main/extend/systemplugin/resourceManager.js b/runtime/main/extend/systemplugin/resourceManager.js index 8c1a1b31..2d0ee701 100644 --- a/runtime/main/extend/systemplugin/resourceManager.js +++ b/runtime/main/extend/systemplugin/resourceManager.js @@ -145,6 +145,20 @@ function ResourceManager(mgrId, module) { console.warn("ResourceManager.getJsonConfig interface mocked in the Previewer. " + "How this interface works on the Previewer may be different from that on a real device.") } + + this.getRawFile = getRawFile; + async function getRawFile(path, callback) { + var data = "mock raw file"; + console.warn("ResourceManager.getRawFile interface mocked in the Previewer. " + + "How this interface works on the Previewer may be different from that on a real device.") + if (typeof callback === 'function') { + callback.call(this, null, data); + } else { + return new Promise((resolve) => { + resolve(data); + }) + } + } } var resourceManager = {