<commit_before>define('Sage/Platform/Mobile/_CommandMixin', [
    'dojo/_base/declare',
    'dojo/dom-attr',
    'dojo/topic',
    './Utility',
    'argos!scene'
], function(
    declare,
    domAttr,
    topic,
    utility,
    scene
) {
    /* todo: convert toolbar to use this */
    return declare('Sage.Platform.Mobile._CommandMixin', null, {
        _commandsByName: null,

        context: null,

        constructor: function() {
            this._commandsByName = {};
        },
        _getContextAttr: function() {
            if (this.context) return this.context;

            return this;
        },
        _setContextAttr: function(value) {
            this.context = value;
        },
        invoke: function(evt, node) {
            var name = typeof evt === 'string'
                    ? evt
                    : node && domAttr.get(node, 'data-command'),
                command = this._commandsByName[name];

            this._invokeCommand(command);
        },
        _invokeCommand: function(command) {
            var context = this.get('context'),
                scope = command.scope || context || command,
                args = utility.expand(command, command.args, command, context, this) || [];

            if (command.fn)
            {
                command.fn.apply(scope, args.concat(context, command));
            }
            else if (command.show)
            {
                scene().showView.apply(scene(), [command.show].concat(args));
            }
            else if (command.action)
            {
                var method = scope && scope[command.action];

                if (typeof method === 'function') method.apply(scope, args.concat(context, command));
            }
            else if (command.publish)
            {
                topic.publish.apply(topic, [command.publish].concat(args, context, command));
            }
        }
    });
});<commit_msg>fixed an issue with broadcasted commands.<commit_after>define('Sage/Platform/Mobile/_CommandMixin', [
    'dojo/_base/declare',
    'dojo/dom-attr',
    'dojo/topic',
    './Utility',
    'argos!scene'
], function(
    declare,
    domAttr,
    topic,
    utility,
    scene
) {
    /* todo: convert toolbar to use this */
    return declare('Sage.Platform.Mobile._CommandMixin', null, {
        _commandsByName: null,

        context: null,

        constructor: function() {
            this._commandsByName = {};
        },
        _getContextAttr: function() {
            if (this.context) return this.context;

            return this;
        },
        _setContextAttr: function(value) {
            this.context = value;
        },
        invoke: function(evt, node) {
            var name = typeof evt === 'string'
                    ? evt
                    : node && domAttr.get(node, 'data-command'),
                command = this._commandsByName[name];
            if (command) this._invokeCommand(command);
        },
        _invokeCommand: function(command) {
            var context = this.get('context'),
                scope = command.scope || context || command,
                args = utility.expand(command, command.args, command, context, this) || [];

            if (command.fn)
            {
                command.fn.apply(scope, args.concat(context, command));
            }
            else if (command.show)
            {
                scene().showView.apply(scene(), [command.show].concat(args));
            }
            else if (command.action)
            {
                var method = scope && scope[command.action];

                if (typeof method === 'function') method.apply(scope, args.concat(context, command));
            }
            else if (command.publish)
            {
                topic.publish.apply(topic, [command.publish].concat(args, context, command));
            }
        }
    });
});
{'fraction_non_alphanumeric': 0.128475798146241, 'fraction_numerical': 0.0, 'mean_word_length': 1.6073825503355705, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7517393', 'n_tokens_mistral': 1030, 'n_tokens_neox': 1014, 'n_words': 209}