1import { hasComplete } from "./utils" 2 3export function mockStorage() { 4 global.systemplugin.storage = { 5 get: function(...args) { 6 console.warn("storage.get interface mocked in the Previewer. How this interface works on the Previewer may be" + 7 " different from that on a real device.") 8 args[0].success("[PC Preview]: no system") 9 hasComplete(args[0].complete) 10 }, 11 set: function(...args) { 12 console.warn("storage.set interface mocked in the Previewer. How this interface works on the Previewer may be" + 13 " different from that on a real device.") 14 args[0].success("[PC Preview]: no system") 15 hasComplete(args[0].complete) 16 }, 17 clear: function(...args) { 18 console.warn("storage.clear interface mocked in the Previewer. How this interface works on the Previewer may be" + 19 " different from that on a real device.") 20 args[0].success("[PC Preview]: no system") 21 hasComplete(args[0].complete) 22 }, 23 delete: function(...args) { 24 console.warn("storage.delete interface mocked in the Previewer. How this interface works on the Previewer may be" + 25 " different from that on a real device.") 26 args[0].success("[PC Preview]: no system") 27 hasComplete(args[0].complete) 28 } 29 } 30 }