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

Transforming an existing type into an STM in v3? #165

Open
xmo-odoo opened this issue Aug 6, 2018 · 0 comments
Open

Transforming an existing type into an STM in v3? #165

xmo-odoo opened this issue Aug 6, 2018 · 0 comments

Comments

@xmo-odoo
Copy link

xmo-odoo commented Aug 6, 2018

In V2, StateMachine.create({target: AClass.prototype}) could be used on more or less arbitrary prototypes and just integrate STM features into that. We use that to make UI widgets (with their own existing lifecycles) into STMs, in-place e.g.

export default class FileUploader: Widget {
    render() {
        // ...
    }
}
StateMachine.create({
    target: FileUploader.prototype,
    events: []
});

It's not really clear how that's supposed to work in V3 and it's not really documented, looking at the code for factory it seems this would work:

StateMachine.factory(FileUploader, transitions: []);

is that the correct migration?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant