Closed rjcorwin closed 5 years ago
To get DatArchive.isOwner
working, I think we'll need to recommend instantiating archives using let archive = await DatArchive.load(address)
as opposed to let archive = new DatArchive(address)
. At first I was thinking we could make a synchronous http call to the proxy in DatArchive.constructor
but I think synchronous http request support has been dropped. Long story short, best practice is to always await the loading of a dat archive instance, it's even sort of recommended in the Beaker Docs.
Create a Dat archive instance from an existing archive. This has the same effect as using the constructor, but allows you to await until load is successful.
This gets the DatArchive.watch API working and also modifies some of the APIs to mirror the Beaker Browser DatArchive API better. The four-in-a-row app almost works with this. Something that would help is if when instantiating an archive that archive instance would have the
DatArchive.isOwner
property. Also four-in-a-row is somehow causing readFile to crash the proxy. I haven't figured that out yet.