Skip to content

Commit

Permalink
update sm wasm
Browse files Browse the repository at this point in the history
  • Loading branch information
dragazo committed Aug 21, 2024
1 parent 1d0ba8c commit 4266998
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion extensions/StateMachine/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
getMenu() {
return {
'Visualize': window.StateMachine_fns.visualize,
'Copy Stateflow Code': window.StateMachine_fns.copy_stateflow_code,

};
}
Expand Down Expand Up @@ -89,13 +90,14 @@
path = path.substring(0, path.lastIndexOf("/"));
var s = document.createElement('script');
s.type = "module";
s.innerHTML = `import init, {check_state, transition, visualize} from '${path}/pkg/netsblox_stateflow_ext.js';
s.innerHTML = `import init, {check_state, copy_stateflow_code, transition, visualize} from '${path}/pkg/netsblox_stateflow_ext.js';
await init();
window.StateMachine_fns = {};
window.StateMachine_fns.check_state = check_state;
window.StateMachine_fns.copy_stateflow_code = copy_stateflow_code;
window.StateMachine_fns.transition = transition;
window.StateMachine_fns.visualize = visualize;
`;
Expand Down
4 changes: 4 additions & 0 deletions extensions/StateMachine/pkg/netsblox_stateflow_ext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export function setup(): void;
*/
export function visualize(): void;
/**
*/
export function copy_stateflow_code(): void;
/**
* @param {any} proc
* @param {any} machine
* @param {any} state
Expand All @@ -26,6 +29,7 @@ export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly setup: () => void;
readonly visualize: () => void;
readonly copy_stateflow_code: () => void;
readonly transition: (a: number, b: number, c: number, d: number) => void;
readonly check_state: (a: number, b: number, c: number, d: number) => void;
readonly __wbindgen_malloc: (a: number, b: number) => number;
Expand Down
6 changes: 6 additions & 0 deletions extensions/StateMachine/pkg/netsblox_stateflow_ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ export function visualize() {
wasm.visualize();
}

/**
*/
export function copy_stateflow_code() {
wasm.copy_stateflow_code();
}

/**
* @param {any} proc
* @param {any} machine
Expand Down
Binary file modified extensions/StateMachine/pkg/netsblox_stateflow_ext_bg.wasm
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export const memory: WebAssembly.Memory;
export function setup(): void;
export function visualize(): void;
export function copy_stateflow_code(): void;
export function transition(a: number, b: number, c: number, d: number): void;
export function check_state(a: number, b: number, c: number, d: number): void;
export function __wbindgen_malloc(a: number, b: number): number;
Expand Down

0 comments on commit 4266998

Please sign in to comment.