Comparing version 1.0.8 to 1.0.9
@@ -66,2 +66,5 @@ "use strict"; | ||
} | ||
end() { | ||
this.wasmSaxParser.end(); | ||
} | ||
async prepareWasm(saxWasm) { | ||
@@ -68,0 +71,0 @@ const result = await WebAssembly.instantiate(saxWasm, { |
{ | ||
"name": "sax-wasm", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"repository": "https://github.com/justinwilaby/sax-wasm", | ||
@@ -5,0 +5,0 @@ "description": "An extremely fast JSX, HTML and XML parser written in Rust compiled to WebAssembly for Node and the Web", |
# SAX (Simple API for XML) for Web Assembly | ||
[![Build Status](https://travis-ci.org/justinwilaby/sax-wasm.svg?branch=master)](https://travis-ci.org/justinwilaby/sax-wasm) | ||
[![Coverage Status](https://coveralls.io/repos/github/justinwilaby/sax-wasm/badge.svg?branch=feature%2Fattribute-positions)](https://coveralls.io/github/justinwilaby/sax-wasm?branch=feature%2Fattribute-positions) | ||
[![Coverage Status](https://coveralls.io/repos/github/justinwilaby/sax-wasm/badge.svg?branch=master)](https://coveralls.io/github/justinwilaby/sax-wasm?branch=master) | ||
@@ -44,4 +44,5 @@ *When you absolutely, positively have to have the fastest parser in the room, accept no substitutes.* | ||
parser.write('<div class="modal"></div>'); | ||
parser.end(); | ||
} | ||
}) | ||
}); | ||
@@ -74,3 +75,4 @@ ``` | ||
} | ||
parser.write('<div class="modal"></div>') | ||
parser.write('<div class="modal"></div>'); | ||
parser.end(); | ||
}); | ||
@@ -122,2 +124,30 @@ ``` | ||
## SAXParser.js | ||
### Methods | ||
- `prepareWasm(wasm: Uint8Array): Promise<boolean>` - Instantiates the wasm binary with reasonable defaults and stores the instance as a member of the class. Always resolves to | ||
true or throws if something went wrong. | ||
- `write(buffer: string): void;` - writes the supplied string to the wasm stream and kicks off processing. | ||
The character and line counters are *not* reset. | ||
- `end(): void;` - Ends processing for the stream. The character and line counters are reset to zero and the parser is | ||
readied for the next document. | ||
### Properties | ||
- `events` - A bitmask containing the events to subscribe to. See the examples for creating the bitmask | ||
- `eventHanlder` - A function reference used for event handling. The supplied function must have a signature that accepts | ||
2 arguments: 1. The `event` which is one of the `SaxEventTypes` and the `body` (listed in the table above) | ||
## sax-wasm.wasm | ||
### Methods | ||
- `parser(events: u32)` - Prepares the parser struct internally and supplies it with the specified events bitmask. Changing | ||
the events bitmask can be done at anytime during processing using this method. | ||
- `write(ptr: *mut u8, length: usize)` - Supplies the parser with the location and length of the newly written bytes in the | ||
stream and kicks off processing. The parser assumes that the bytes are valid utf-8. Writing non utf-8 bytes will may cause | ||
unpredictable behavior. | ||
- `end()` - resets the character and line counts but does not halt processing of the current buffer. | ||
## Building from source | ||
@@ -132,3 +162,3 @@ ### Prerequisites | ||
``` | ||
Install the nightly compiler and switch to it | ||
Install the nightly compiler and switch to it. | ||
```bash | ||
@@ -138,2 +168,6 @@ rustup install nightly | ||
``` | ||
Install the wasm32-unknown-unknown target. | ||
```bash | ||
rustup target add wasm32-unknown-unknown --toolchain nightly | ||
``` | ||
Install [node with npm](https://nodejs.org/en/) then run the following command from the project root. | ||
@@ -147,1 +181,2 @@ ```bash | ||
``` | ||
The artifacts from the build will be located in the `/libs` directory. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
68695
112
177