scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
41 lines • 915 B
JavaScript
import { AbsQuickLook } from "scriptable-abstract";
import { MockData } from "../data";
import { MockImage } from "../media/image";
class MockQuickLook extends AbsQuickLook {
static get instance() {
return super.instance;
}
constructor() {
super({
lastPreviewedItem: null
});
}
/**
* @inheritdoc
*/
async present(item) {
if (item instanceof MockImage || item instanceof MockData || typeof item === "string") {
this.setState({ lastPreviewedItem: item });
} else {
throw new Error("Invalid item type for QuickLook preview");
}
}
/**
* @additional
* Get the last previewed item
*/
getLastPreviewedItem() {
return this.state.lastPreviewedItem;
}
/**
* @additional
* Clear the preview history
*/
clear() {
this.setState({ lastPreviewedItem: null });
}
}
export {
MockQuickLook
};
//# sourceMappingURL=quick-look.js.map