[READ-ONLY] Mirror of https://github.com/gossi/ember-command. Integrate your Business Logic with Ember gossi.github.io/ember-command
ember-command docs functions.md

Functions #

Functions are the most pure form to perform tasks. Dependency injection through parameters, a function has all the things needed to operate. ember-command can be composed of functions:

import { on } from '@ember/modifier';
import { command } from 'ember-command';

function sayHello() {
  console.log('Hello);
}

<template>
  <button {{on "click" (command sayHello)}}>Say Hello</button>
</template>

And using (fn) helper to pass it parameters:

import { on } from '@ember/modifier';
import { fn } from '@ember/helper';
import { command } from 'ember-command';

function sayHello(name: string) {
  console.log('Hello', name);
}

<template>
  <button {{on "click" (command (fn sayHello 'gossi'))}}>Say Hello</button>
</template>