1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
<script src="../src/localStorage.js"></script>
<script src="../dist/main.js"></script>
<div id="results"></div>
<script>
runStorage( "/test-folder/test-file.ttl","<> a <#test>." ).then( ()=>{
runRest( "/test-folder/test-file.ttl","<> a <#test>." )
})
async function runStorage(file,text){
const storage = new SolidLocalStorage()
let response = await storage.putResource( file,{body:text} )
response = await storage.getResource( file )
show(await response)
}
async function runRest(file,text){
const rest = new SolidRest( new SolidLocalStorage() )
show(rest.storage.name)
let response = await rest.fetch( file,{method:"PUT",body:text} )
response = await rest.fetch( file )
show(await response.text())
}
function show(msg){
let display = document.getElementById("results")
display.innerHTML = display.innerHTML + `<p>${msg}</p>`
}
</script>
|