Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue integration #74

Open
Trellian opened this issue Oct 20, 2019 · 2 comments
Open

Vue integration #74

Trellian opened this issue Oct 20, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Trellian
Copy link

No description provided.

@matthewp
Copy link
Owner

There are no currently plans, but it might happen. More likely to happen if someone volunteers to do it! If you look at the other integrations it's pretty small and easy to do.

@matthewp matthewp changed the title Are there any plans to integrate with Vue.js ? Vue integration Oct 21, 2019
@matthewp matthewp added the enhancement New feature or request label Oct 21, 2019
@xar
Copy link
Contributor

xar commented Dec 11, 2019

Using @vue/composition-api something like this could work:
(inspired by svelte example here in other issue)

const vueRobot = (machine: any) => {
    const _state = ref(machine.current);
    const _context = ref(machine.context());

    const { setState, state } = {
        setState(newState: any) {
            _state.value = newState;
        },
        state: _state
    };
    const { setContext, context } = {
        setContext(newContext: any) {
            _context.value = newContext;
        },
        context: _context
    };

    const { send } = interpret(machine, service => {
        setState(service.machine.current);
        setContext(service.context);
    });

    return { context, send, state };
};

@ehuelsmann ehuelsmann self-assigned this Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants