What is the "hasOwnProperty()" equivalent for interface?
I have found this related bug at Adobe: https://bugs.adobe.com/jira/browse/FB-27683
Any workaround except try..catch statement?
The hasOwnProperty() method returns a boolean indicating whether the object has the specified property as its own property (as opposed to inheriting it).
JavaScript | hasOwnProperty() Method The hasOwnProperty() method in JavaScript is used to check whether the object has the specified property as its own property. This is useful for checking if the object has inherited the property rather than being it's own.
Have you considered this?
if("foo" in bar){ ...
where "foo" is the name of a property and bar is the object reference as Interface?
Here it is in action in a real world scenario:
import flash.events.IEventDispatcher;
import flash.events.EventDispatcher;
var i:IEventDispatcher = new EventDispatcher();
if("dispatchEvent" in i){
trace(" I have dispatchEvent");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With