How to use the @aurelia/jit.BindingCommand.define function in @aurelia/jit

To help you get started, we’ve selected a few @aurelia/jit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aurelia / aurelia / packages / __tests__ / i18n / t / translation-render.spec.ts View on Github external
function setup(aliases?: string[]) {
    aliases = aliases || [];
    const container = DI.createContainer(BindingCommand.define({ name: 't', aliases }, TranslationBindingCommand));
    if (!aliases.includes('t')) {
      aliases.push('t');
    }
    return aliases.reduce(
      (acc: TranslationBindingCommand[], alias) => {
        acc.push(
          container.get(BindingCommand.keyFrom(alias)),
        );
        return acc;
      },
      []);
  }
github aurelia / aurelia / packages / __tests__ / i18n / t / translation-render.spec.ts View on Github external
function setup(aliases?: string[]) {
    aliases = aliases || [];
    aliases = aliases.map(alias => `${alias}.bind`);
    const container = DI.createContainer(BindingCommand.define({ name: 't.bind', aliases }, TranslationBindBindingCommand));
    if (!aliases.includes('t.bind')) {
      aliases.push('t.bind');
    }
    return aliases.reduce(
      (acc: TranslationBindBindingCommand[], alias) => {
        acc.push(
          container.get(BindingCommand.keyFrom(alias)),
        );
        return acc;
      },
      []);
  }
github aurelia / aurelia / packages / i18n / dist / esnext / configuration.js View on Github external
const bindAlias = `${alias}.bind`;
        patterns.push({ pattern: alias, symbols: '' });
        TranslationAttributePattern.registerAlias(alias);
        bindPatterns.push({ pattern: bindAlias, symbols: '.' });
        TranslationBindAttributePattern.registerAlias(alias);
        if (alias !== 't') {
            commandAliases.push(alias);
            bindCommandAliases.push(bindAlias);
        }
    }
    const renderers = [
        AttributePattern.define(patterns, TranslationAttributePattern),
        BindingCommand.define({ name: 't', aliases: commandAliases }, TranslationBindingCommand),
        TranslationBindingRenderer,
        AttributePattern.define(bindPatterns, TranslationBindAttributePattern),
        BindingCommand.define({ name: 't.bind', aliases: bindCommandAliases }, TranslationBindBindingCommand),
        TranslationBindBindingRenderer,
        TranslationParametersAttributePattern,
        TranslationParametersBindingCommand,
        TranslationParametersBindingRenderer
    ];
    return {
        register(container) {
            return container.register(Registration.callback(I18nInitOptions, () => options.initOptions), StartTask.with(I18N).beforeBind().call(i18n => i18n.task), Registration.singleton(I18nWrapper, I18nextWrapper), Registration.singleton(I18N, I18nService), ...renderers, ...translation);
        }
    };
}
const dateFormat = [
github aurelia / aurelia / packages / i18n / dist / esnext / configuration.js View on Github external
const commandAliases = [];
    const bindCommandAliases = [];
    for (const alias of aliases) {
        const bindAlias = `${alias}.bind`;
        patterns.push({ pattern: alias, symbols: '' });
        TranslationAttributePattern.registerAlias(alias);
        bindPatterns.push({ pattern: bindAlias, symbols: '.' });
        TranslationBindAttributePattern.registerAlias(alias);
        if (alias !== 't') {
            commandAliases.push(alias);
            bindCommandAliases.push(bindAlias);
        }
    }
    const renderers = [
        AttributePattern.define(patterns, TranslationAttributePattern),
        BindingCommand.define({ name: 't', aliases: commandAliases }, TranslationBindingCommand),
        TranslationBindingRenderer,
        AttributePattern.define(bindPatterns, TranslationBindAttributePattern),
        BindingCommand.define({ name: 't.bind', aliases: bindCommandAliases }, TranslationBindBindingCommand),
        TranslationBindBindingRenderer,
        TranslationParametersAttributePattern,
        TranslationParametersBindingCommand,
        TranslationParametersBindingRenderer
    ];
    return {
        register(container) {
            return container.register(Registration.callback(I18nInitOptions, () => options.initOptions), StartTask.with(I18N).beforeBind().call(i18n => i18n.task), Registration.singleton(I18nWrapper, I18nextWrapper), Registration.singleton(I18N, I18nService), ...renderers, ...translation);
        }
    };
}
const dateFormat = [