-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actually include wasm package to the repo
- Loading branch information
Showing
7 changed files
with
928 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
# namakemono document visualizer `wasm` | ||
|
||
WebAssembly package used in namakemono [document visualizer](https://github.com/p2panda/nama-document-viz). Depends on private & unreleased | ||
[namakemono](https://github.com/p2panda/namakemono) crate. | ||
|
||
## 🛠️ Build with `wasm-pack build` | ||
|
||
``` | ||
wasm-pack build | ||
``` | ||
|
||
## 🔬 Test in Headless Browsers with `wasm-pack test` | ||
|
||
``` | ||
wasm-pack test --headless --firefox | ||
``` | ||
|
||
## 🎁 Publish to NPM with `wasm-pack publish` | ||
|
||
``` | ||
wasm-pack publish | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* Sets a [`panic hook`] for better error messages in NodeJS or web browser. | ||
* | ||
* [`panic hook`]: https://crates.io/crates/console_error_panic_hook | ||
*/ | ||
export function setWasmPanicHook(): void; | ||
/** | ||
*/ | ||
export class Document { | ||
free(): void; | ||
/** | ||
* Create a new document. | ||
*/ | ||
constructor(); | ||
/** | ||
* Add an operation to the document. | ||
* @param {Operation} operation | ||
* @returns {(Operation)[]} | ||
*/ | ||
add(operation: Operation): (Operation)[]; | ||
/** | ||
* Create and add an operation to this document. The author is selected based on their string | ||
* name. | ||
* @param {string} author_name | ||
* @param {number} timestamp | ||
* @returns {Operation} | ||
*/ | ||
create(author_name: string, timestamp: number): Operation; | ||
/** | ||
* Prune operations from the document older than the passed timestamp. | ||
* @param {number} timestamp | ||
* @returns {any} | ||
*/ | ||
pruneBeforeTimestamp(timestamp: number): any; | ||
/** | ||
* Prune operations from each of the documents author logs older than the passed depth | ||
* @param {number} depth | ||
* @returns {any} | ||
*/ | ||
pruneBeforeDepthPerLog(depth: number): any; | ||
/** | ||
* Prune operations from the document older than the passed depth (after sorting) | ||
* @param {number} depth | ||
* @returns {any} | ||
*/ | ||
pruneBeforeDepth(depth: number): any; | ||
/** | ||
* Get all operations from this document in their sorted order. | ||
* @returns {(Operation)[]} | ||
*/ | ||
operations(): (Operation)[]; | ||
/** | ||
* Get a single operation by it's hash id. | ||
* @param {string} hash | ||
* @returns {Operation | undefined} | ||
*/ | ||
get(hash: string): Operation | undefined; | ||
/** | ||
* Get the current tips of this document. | ||
* @returns {any} | ||
*/ | ||
tips(): any; | ||
} | ||
/** | ||
* Core data type which authors publish in order to create, update and delete documents. | ||
* | ||
* Implements the required traits `Authored`, `Causal`, `Hashable` and `Timestamped`. | ||
*/ | ||
export class Operation { | ||
free(): void; | ||
/** | ||
* The hash id of this operation. | ||
* @returns {string} | ||
*/ | ||
hash(): string; | ||
/** | ||
* Public key of the signing author. | ||
* @returns {string} | ||
*/ | ||
publicKey(): string; | ||
/** | ||
* String name assigned to the operations author. | ||
* @returns {string} | ||
*/ | ||
authorName(): string; | ||
/** | ||
* Sequence number of this operation. | ||
* @returns {number} | ||
*/ | ||
seqNum(): number; | ||
/** | ||
* Timestamp of when this operation was created. | ||
* @returns {number} | ||
*/ | ||
timestamp(): number; | ||
/** | ||
* Hash id of the operation proceeding this one in the log. | ||
* @returns {string | undefined} | ||
*/ | ||
backlink(): string | undefined; | ||
/** | ||
* The current graph tips of this operations' document. | ||
* @returns {(string)[]} | ||
*/ | ||
previous(): (string)[]; | ||
} | ||
/** | ||
* A collection of operations. | ||
*/ | ||
export class Operations { | ||
free(): void; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import * as wasm from "./nama_document_viz_wasm_bg.wasm"; | ||
import { __wbg_set_wasm } from "./nama_document_viz_wasm_bg.js"; | ||
__wbg_set_wasm(wasm); | ||
export * from "./nama_document_viz_wasm_bg.js"; |
Oops, something went wrong.