All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.assets.rjzjh.zrender.graphic.mixin.Stateful.js Maven / Gradle / Ivy

There is a newer version: 2.0.0
Show newest version
/**
 * Stateful mixin for graphic object
 */

define(function (require) {

    var States = require('../States');

    var Stateful = function (opts) {

        if (opts.states) {
            this.initStates(opts.states);
        }
    };

    Stateful.prototype = {

        initStates: function (states) {
            this._states = new States({
                el: this,
                states: states
            });
        },

        setState: function (name) {
            this._states && this._states.setState(name);
        },

        getState: function () {
            return this._states && this._states.getState();
        },

        transitionState: function (name, done) {
            this._states && this._states.transitionState(name, done);
        }
    };

    return Stateful;
});




© 2015 - 2024 Weber Informatics LLC | Privacy Policy