-
Notifications
You must be signed in to change notification settings - Fork 370
Description
My experience trying to run the snippets at Mount Data has been a bit frustrating. For example, I haven't been able to test this snippet:
window.showDirectoryPicker().then(function (directoryHandle) {
window.parent.postMessage({
type: 'mount-directory-handle',
directoryHandle,
mountpoint: '/wordpress/wp-content/uploads/markdown/',
});
});
-
How can I use
directoryHandlereturned by the promise to mount a local folder on a client got doingconst client = await startPlaygroundWeb({...}) -
What's
window.parent.postMessagefor? It seems to be a way to communicate with web workers atremote.htmlbut this is not documented anywhere. Shouldn't thiswindow.parent.postMessagebe run somehow fromremote.html(as it's meant to be triggered from a child iframe?
If I do this
window.playgroundMountDirectory = async () => {
const directoryHandle = await window.showDirectoryPicker()
console.log(client.mount);
console.log(directoryHandle);
console.assert(!window.parent, '⚠️ window.parent is empty')
window.parent.postMessage({
type: 'mount-directory-handle',
directoryHandle,
mountpoint: '/wordpress/wp-content/uploads/custom/',
});
const mounted = await client.listFiles('/wordpress/wp-content/uploads/custom/')
console.log(mounted);
console.assert(mounted.length > 0, '⚠️ Mounted directory is empty')
}
I get this
In that section, there's also a section and an example of Mount Browser's OPFS Storage. I'm missing in this section a brief introduction of what OPFS. AFAIU setting OPFS storage would persist changes across storage.
I have also tested the OPFS snippet and it's not persisting any changes in the content or plugins installations. Shouldn't it?
cc: @fellyph