Avatar

frankysnow

3 public vals
Joined June 17, 2023
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
let { xstateStateEx } = await import("https://esm.town/v/frankysnow/xstateStateEx");
export const xstateEx = async (event: string) => {
const { createMachine } = await import("npm:xstate");
const toggleMachine = createMachine({
id: "toggle",
initial: "inactive",
states: {
inactive: { on: { TOGGLE: "active" } },
active: { on: { TOGGLE: "inactive" } },
},
});
let state = xstateStateEx || toggleMachine.initialState;
return xstateStateEx =
toggleMachine.transition(state, event).value;
};
// Forked from @stevekrouse.xstateEx
1
2
3
4
5
6
7
8
// email yourself as easily as logging to the console: `console.email`
export let consoleEmailEx = (() => {
console.email("message"); // any JSON object can be the message
console.email({ html: "<h1>hello html emails!</h1>" }); // you can send HTML emails
console.email({ hi: "there" }, "Subject Line"); // optional second arg is the subject line
console.email({ html: "<b>hi!</b>", subject: "Subject accepted here too" });
})();
// Forked from @stevekrouse.consoleEmailEx
1
2
3
export function myApi(name: Interval) {
console.email("hi " + name);
}
Next