scriptable-testlab
Version:
A lightweight, efficient tool designed to manage and update scripts for Scriptable.
45 lines • 850 B
JavaScript
import { AbsUUID } from "scriptable-abstract";
class MockUUID extends AbsUUID {
static get instance() {
return super.instance;
}
constructor() {
super({
lastGeneratedUUID: null
});
}
/**
* @inheritdoc
*/
string() {
const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
const r = Math.random() * 16 | 0;
const v = c === "x" ? r : r & 3 | 8;
return v.toString(16);
});
this.setState({
lastGeneratedUUID: uuid
});
return uuid;
}
/**
* @additional
* Get the last generated UUID
*/
getLastGeneratedUUID() {
return this.state.lastGeneratedUUID;
}
/**
* @additional
* Clear UUID history
*/
clear() {
this.setState({
lastGeneratedUUID: null
});
}
}
export {
MockUUID
};
//# sourceMappingURL=uuid.js.map