Add a new host function

This commit is contained in:
Brooks J Rady 2021-01-11 06:02:59 +00:00
parent d79db4acb3
commit 4592f12349
2 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,6 @@
[package]
name = "mosaic-tile"
version = "0.2.2"
version = "0.3.0"
authors = ["Brooks J Rady <b.j.rady@gmail.com>"]
edition = "2018"
description = "A small client-side library for writing mosaic plugins (tiles)"

View file

@ -34,7 +34,13 @@ pub fn open_file(path: &Path) {
unsafe { host_open_file() };
}
pub fn set_selectable(selectable: bool) {
let selectable = if selectable { 1 } else { 0 };
unsafe { host_set_selectable(selectable) };
}
#[link(wasm_import_module = "mosaic")]
extern "C" {
fn host_open_file();
fn host_set_selectable(selectable: i32);
}