candlecorp / wick

Functional, reactive WebAssembly with a twist
https://candle.dev
Other
471 stars 17 forks source link

feat request: `func` Wick Type like WIT type #465

Open DougAnderson444 opened 11 months ago

DougAnderson444 commented 11 months ago

feature request The WIT model has func types, but it appears Wick IT does not?

For example, you can define a func that is the host's console_log to log output on the host from the WIT component.

Propose a solution Add an importable host type called func (or if this is possible already, description/docs how to use it)

Describe alternatives you've considered I'm new to Wick, so I don't see an alternative, but perhaps one exists?

Additional context I'd like to be able to generate HTML from my Wick component, and then addEventListener using the browser's host function for this. I've done this with WIT and would like to try it with Wick.

jsoverson commented 11 months ago

A wick component is essentially a collection of exported functions (with associated types). Wick's operations serve as functions the module exports. Wick components can import modules with a certain interface. It's up to the host to wire everything together. This happens in the CLI but is not yet implemented in the JS client.

For logging to the console though, you can build components for wasi and anything you print to stdout will go to the console