Object.defineProperty(exports, "__esModule", { value: true });
module.exports = function (actionAPI) {
    //Handle the action when executed
    actionAPI.handle(function (properties, status) {
        var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
        if (connectionID != 'none') {
            var connection = actionAPI.getConnection('mitti', connectionID);
            var mitti = connection.instance;
            mitti
                .play()
                .then(function () {
                status("Current clip playing", 'info');
            })
                .catch(function (error) {
                status(error.message, 'error');
            });
        }
        else
            status('No connection specified', 'error');
    });
    //Handle the interactive editor
    actionAPI.onOpenEditor(function (editorAPI, properties) {
        var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
        editorAPI.onFieldChanges(function (fields) {
            var fieldValues = editorAPI.tools.objectifyFieldsValues(fields);
            editorAPI.saveProperties({ connectionID: fieldValues.connectionID });
        });
        editorAPI.setFields([
            {
                id: 'connectionID',
                name: 'Connection',
                type: 'connection',
                value: connectionID,
                connectionType: 'mitti'
            }
        ]);
    });
};
//# sourceMappingURL=play.js.map