Initial commit: Receipt Studio desktop application
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import { randomUUID } from 'node:crypto'
|
||||
|
||||
// Keep print content in memory. The renderer receives a short local URL even when stamps are large.
|
||||
export class PrintDocumentStore {
|
||||
private documents=new Map<string,string>()
|
||||
publish(html:string):{url:string;dispose:()=>void}{
|
||||
const url='receipt://print/'+randomUUID()+'/index.html'
|
||||
this.documents.set(url,html)
|
||||
return {url,dispose:()=>{this.documents.delete(url)}}
|
||||
}
|
||||
read(url:string):string|undefined{return this.documents.get(url)}
|
||||
}
|
||||
export const printDocuments=new PrintDocumentStore()
|
||||
Reference in New Issue
Block a user