Skip to content

Commit

Permalink
feat(js): new glue hash function
Browse files Browse the repository at this point in the history
  • Loading branch information
frelodev committed Aug 27, 2024
1 parent fc9247c commit 4a70181
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dist/js/build.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
npx napi build --release --cargo-cwd ../..
npx napi build --cargo-cwd ../..
2 changes: 1 addition & 1 deletion dist/js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@codemp/codemp",
"version": "0.0.5",
"version": "0.0.9-debug",

"dependencies": {
"@napi-rs/cli": "^2.18.0",
Expand Down
8 changes: 8 additions & 0 deletions src/ffi/js/ext.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use napi_derive::napi;
use crate::hash;


#[napi(js_name = "hash")]
pub fn js_hash(str : String) -> napi::Result<i64>{
Ok(hash(str))
}
2 changes: 2 additions & 0 deletions src/ffi/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ pub mod workspace;
pub mod cursor;
pub mod buffer;
pub mod op_cache;
pub mod ext;


impl From<crate::Error> for napi::Error {
fn from(value: crate::Error) -> Self {
Expand Down

0 comments on commit 4a70181

Please sign in to comment.