mirror of
https://github.com/encounter/jco.git
synced 2026-03-30 11:18:26 -07:00
d70b4d4472
* feat(examples): add documentation and walkthroughs for examples This commit adds documentation along with walkthroughs for how to use `jco` when building and deploying WebAssembly components. Signed-off-by: Victor Adossi <vadossi@cosmonic.com> * refactor(ci): use the all target for examples Signed-off-by: Victor Adossi <vadossi@cosmonic.com> * chore(ci): run examples on every push to main Signed-off-by: Victor Adossi <vadossi@cosmonic.com> --------- Signed-off-by: Victor Adossi <vadossi@cosmonic.com> Co-authored-by: Guy Bedford <gbedford@fastly.com>
27 lines
921 B
JavaScript
27 lines
921 B
JavaScript
/**
|
|
* This module is the JS implementation of the `revup` WIT world
|
|
*/
|
|
|
|
/**
|
|
* The import here is *virtual*. It refers to the `import`ed `reverse` interface in component.wit.
|
|
*
|
|
* These types *do not resolve* when the first `string-reverse-upper` component is built,
|
|
* but the types are relevant for the resulting *composed* component.
|
|
*/
|
|
import { reverseString } from 'example:string-reverse/reverse@0.1.0';
|
|
|
|
/**
|
|
* The Javascript export below represents the export of the `reversed-upper` interface,
|
|
* which which contains `revup` as it's primary exported function.
|
|
*/
|
|
export const reversedUpper = {
|
|
/**
|
|
* Represents the implementation of the `reverse-and-uppercase` function in the `reversed-upper` interface
|
|
*
|
|
* This function makes use of `reverse-string` which is *imported* from another WebAssembly binary.
|
|
*/
|
|
reverseAndUppercase(s) {
|
|
return reverseString(s).toLocaleUpperCase();
|
|
},
|
|
};
|