github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/app/helpers/bind.js (about) 1 import { helper } from '@ember/component/helper'; 2 import { assert } from '@ember/debug'; 3 4 /** 5 * bind 6 * 7 * Usage: {{bind this.function}} 8 * 9 * Returns a version of a function bound to the template target (e.g., component or controller) 10 */ 11 export function bind([func, target]) { 12 assert( 13 'A function is required as the first argument', 14 typeof func === 'function' 15 ); 16 assert('A context is required as the second argument', target); 17 return func.bind(target); 18 } 19 20 export default helper(bind);