Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async files(): Promise {
return JSON.parse(localStorage['nomnoml.file_index'] || '[]') as FileEntry[]
}
async read(name: string): Promise {
async insert(name: string, source: string): Promise {
var entry: FileEntry = {
date: (new Date()).toISOString(),
collaborators: [],
name: name,
revision: 0,
}
var index = await this.files()
if (!nomnoml.skanaar.find(index, e => e.name === name)) {
index.push(entry)
index.sort((a,b) => a.name.localeCompare(b.name))
localStorage['nomnoml.file_index'] = JSON.stringify(index)
}
localStorage[this.prefix+name] = source
}
async save(name: string, source: string): Promise {
async files(): Promise {
return JSON.parse(localStorage['nomnoml.file_index'] || '[]') as FileEntry[]
}
async read(name: string): Promise { return this.source }
files(): FileEntry[] {
return JSON.parse(localStorage['nomnoml.file_index'] || '[]') as FileEntry[]
}
setFiles(index: FileEntry[]): void {
async files(): Promise {
return JSON.parse(localStorage['nomnoml.file_index'] || '[]') as FileEntry[]
}
async read(name: string): Promise { return localStorage[this.storageKey] }