Skip to content

Commit

Permalink
zbox-browser release v0.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
burmecia committed Jan 1, 2020
1 parent 9843c17 commit 9b7761c
Show file tree
Hide file tree
Showing 10 changed files with 373 additions and 159 deletions.
3 changes: 3 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[target.wasm32-unknown-unknown]
ar = "/emsdk/upstream/bin/llvm-ar"
linker = "/emsdk/upstream/bin/lld"
100 changes: 50 additions & 50 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ details about [ZboxFS].

## Installation

1. Download `zbox-browser-0.5.0.tar.gz` from [latest release]
1. Download `zbox-browser-0.6.0.tar.gz` from [latest release]
2. Extract it to your website's `static` or `public` folder
3. Import it using `<script>` tag

```html
<script src="zbox-browser-0.5.0/index.js"></script>
<script src="zbox-browser-0.6.0/index.js"></script>
```

**Note**: because of [same-origin policy] restriction, use this package as a
Expand All @@ -27,7 +27,7 @@ Visit https://zbox.io/try to create a test repo. Copy its URI and replace
`[your_repo_uri]` in below.

```html
<script src="zbox-browser-0.5.0/index.js"></script>
<script src="zbox-browser-0.6.0/index.js"></script>

<script>
(async () => {
Expand Down
15 changes: 15 additions & 0 deletions js/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ const MsgTypes = {
name: 'exists',
arg: ['string']
},
destroy: {
name: 'destroy',
arg: ['string']
},
openRepo: {
name: 'openRepo',
arg: [{
Expand Down Expand Up @@ -102,6 +106,13 @@ const MsgTypes = {
{ to: { type: 'string' } }
]
},
copyDirAll: {
name: 'copyDirAll',
arg: [
{ from: { type: 'string' } },
{ to: { type: 'string' } }
]
},
removeFile: {
name: 'removeFile',
arg: ['string']
Expand Down Expand Up @@ -186,6 +197,10 @@ const MsgTypes = {
name: 'close',
arg: []
},
version: {
name: 'version',
arg: []
},
read: {
name: 'read',
arg: ['buffer']
Expand Down
19 changes: 19 additions & 0 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ function zboxMsgHandler(msg, msgTypes) {
return;
}

case msgTypes.destroy.name: {
ensureStr(msg.params);
msg.result = zbox.Repo.destroy(msg.params);
postMessage(msg);
return;
}

case msgTypes.openRepo.name: {
ensureStr2(msg.params.uri, msg.params.pwd);

Expand Down Expand Up @@ -255,6 +262,12 @@ function repoMsgHandler(msg, msgTypes) {
break;
}

case msgTypes.copyDirAll.name: {
ensureStr2(msg.params.from, msg.params.to);
repo.copyDirAll(msg.params.from, msg.params.to);
break;
}

case msgTypes.removeFile.name: {
ensureStr(msg.params);
repo.removeFile(msg.params);
Expand Down Expand Up @@ -405,6 +418,12 @@ function versionReaderMsgHandler(msg, msgTypes) {
break;
}

case msgTypes.version.name: {
let ver = vrdr.version();
msg.result = ver;
break;
}

case msgTypes.read.name: {
let buf = new Uint8Array(msg.params.buf, msg.params.offset, msg.params.len);
const read = vrdr.read(buf);
Expand Down
103 changes: 103 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zbox/browser",
"version": "0.5.0",
"version": "0.6.0",
"description": "Browser javascript binding for ZboxFS",
"keywords": [
"webassembly",
Expand Down
Loading

0 comments on commit 9b7761c

Please sign in to comment.