22 lines
459 B
JavaScript
22 lines
459 B
JavaScript
function Platform() {
|
|
this.save = async (path, data) => {
|
|
localStorage.setItem(path, data)
|
|
}
|
|
|
|
this.open = (path) => {
|
|
return localStorage.getItem(path)
|
|
}
|
|
|
|
this.readdir = (path) => {
|
|
return Object.keys(localStorage)
|
|
.filter(key => key.startsWith(path))
|
|
}
|
|
|
|
this.createWindow = url => {
|
|
return window.open(url ?? 'about:blank', '_blank')
|
|
}
|
|
|
|
this.createInstance = url => {
|
|
return window.open(url ?? this.location)
|
|
}
|
|
} |