From 9120a19aedeed0399b876a50ba0445aa2c3b14ae Mon Sep 17 00:00:00 2001 From: "mukilan.e" Date: Sun, 18 Aug 2019 23:43:35 +0530 Subject: [PATCH] [DOC] Add examples for EmberArray#invoke --- .../@ember/-internals/runtime/lib/mixins/array.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/@ember/-internals/runtime/lib/mixins/array.js b/packages/@ember/-internals/runtime/lib/mixins/array.js index 6fe4db4e35a..6ee9453c2be 100644 --- a/packages/@ember/-internals/runtime/lib/mixins/array.js +++ b/packages/@ember/-internals/runtime/lib/mixins/array.js @@ -967,6 +967,18 @@ const ArrayMixin = Mixin.create(Enumerable, { implements it. This method corresponds to the implementation in Prototype 1.6. + ```javascript + const Person = EmberObject.extend({ + name: null, + greet(prefix) { + return `${prefix} ${this.name}`; + } + }); + let people = [Person.create('Joe'), Person.create('Matt')]; + + people.invoke('greet', 'Hello'); // ['Hello Joe', 'Hello Matt'] + ``` + @method invoke @param {String} methodName the name of the method @param {Object...} args optional arguments to pass as well.