mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-23 12:58:11 +08:00
Define the js wasm-editor interface (#31)
This commit is contained in:
committed by
Keavon Chambers
parent
1b8c71d2b3
commit
d254916430
@@ -1,5 +1,5 @@
|
||||
use crate::EditorError;
|
||||
type PanelId = usize;
|
||||
pub type PanelId = usize;
|
||||
|
||||
struct LayoutRoot {
|
||||
hovered_panel: PanelId,
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
pkg/
|
||||
@@ -1,23 +0,0 @@
|
||||
[package]
|
||||
name = "wasm-bindings"
|
||||
version = "0.1.0"
|
||||
authors = ["Keavon Chambers <graphite@keavon.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
default = ["console_error_panic_hook"]
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen = "0.2.72"
|
||||
|
||||
# The `console_error_panic_hook` crate provides better debugging of panics by
|
||||
# logging them with `console.error`. This is great for development, but requires
|
||||
# all the `std::fmt` and `std::panicking` infrastructure, so isn't great for
|
||||
# code size when deploying.
|
||||
console_error_panic_hook = { version = "0.1.6", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
wasm-bindgen-test = "0.3.22"
|
||||
@@ -1,14 +0,0 @@
|
||||
mod utils;
|
||||
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
fn alert(s: &str);
|
||||
}
|
||||
|
||||
#[wasm_bindgen(start)]
|
||||
pub fn init() {
|
||||
utils::set_panic_hook();
|
||||
alert("Hello, Graphite!");
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
pub fn set_panic_hook() {
|
||||
// When the `console_error_panic_hook` feature is enabled, we can call the
|
||||
// `set_panic_hook` function at least once during initialization, and then
|
||||
// we will get better error messages if our code ever panics.
|
||||
//
|
||||
// For more details see
|
||||
// https://github.com/rustwasm/console_error_panic_hook#readme
|
||||
#[cfg(feature = "console_error_panic_hook")]
|
||||
console_error_panic_hook::set_once();
|
||||
}
|
||||
Reference in New Issue
Block a user