Ember.canInvoke()

canInvoke (obj, methodName) Booleanprivate

Defined in packages/ember-metal/lib/utils.js:316

Checks to see if the methodName exists on the obj.

let foo = { bar: function() { return 'bar'; }, baz: null };

Ember.canInvoke(foo, 'bar'); // true
Ember.canInvoke(foo, 'baz'); // false
Ember.canInvoke(foo, 'bat'); // false

Parameters:

obj Object
The object to check for the method
methodName String
The method name to check for

Returns:

Boolean
doc_EmberJs
2016-11-30 16:51:10
Comments
Leave a Comment

Please login to continue.