Dart DocumentationjsFunctionProxy

FunctionProxy class

A Proxy subtype to JavaScript functions.

class FunctionProxy extends Proxy implements Serializable<FunctionProxy> /*,Function*/ {
 FunctionProxy._internal(SendPortSync port, id) : super._internal(port, id);

 // TODO(vsm): This allows calls with a limited number of arguments
 // in the context of dartbug.com/9283.  Eliminate pending the resolution
 // of this bug.  Note, if this Proxy is called with more arguments then
 // allowed below, it will trigger the 'call' path in Proxy.noSuchMethod
 // - and still work correctly in unminified mode.
 call([arg1 = _undefined, arg2 = _undefined,
       arg3 = _undefined, arg4 = _undefined,
       arg5 = _undefined, arg6 = _undefined]) {
   var arguments = _pruneUndefined(arg1, arg2, arg3, arg4, arg5, arg6);
   return Proxy._forward(this, '', 'apply', arguments);
 }
}

Extends

Proxy > FunctionProxy

Implements

Serializable<FunctionProxy>

Operators

dynamicoperator [](arg) #

inherited from Proxy
operator[](arg) => _forward(this, '[]', 'method', [ arg ]);

dynamicoperator []=(key, value) #

inherited from Proxy
operator[]=(key, value) => _forward(this, '[]=', 'method', [ key, value ]);

dynamicoperator ==(other) #

inherited from Proxy

The equality operator.

The default behavior for all Objects is to return true if and only if this and other are the same object.

If a subclass overrides the equality operator it should override the hashCode method as well to maintain consistency.

docs inherited from Object
operator==(other) => identical(this, other)
   ? true
   : (other is Proxy &&
      _jsPortEquals.callSync([_serialize(this), _serialize(other)]));

Methods

dynamiccall([arg1 = _undefined, arg2 = _undefined, arg3 = _undefined, arg4 = _undefined, arg5 = _undefined, arg6 = _undefined]) #

call([arg1 = _undefined, arg2 = _undefined,
     arg3 = _undefined, arg4 = _undefined,
     arg5 = _undefined, arg6 = _undefined]) {
 var arguments = _pruneUndefined(arg1, arg2, arg3, arg4, arg5, arg6);
 return Proxy._forward(this, '', 'apply', arguments);
}

dynamicnoSuchMethod(InvocationMirror invocation) #

inherited from Proxy

noSuchMethod is invoked when users invoke a non-existant method on an object. The name of the method and the arguments of the invocation are passed to noSuchMethod in an InvocationMirror. If noSuchMethod returns a value, that value becomes the result of the original invocation.

The default behavior of noSuchMethod is to throw a noSuchMethodError.

docs inherited from Object
noSuchMethod(InvocationMirror invocation) {
 String member = invocation.memberName;
 // If trying to access a JavaScript field/variable that starts with
 // _ (underscore), Dart treats it a library private and member name
 // it suffixed with '@internalLibraryIdentifier' which we have to
 // strip before sending over to the JS side.
 if (member.indexOf('@') != -1) {
   member = member.substring(0, member.indexOf('@'));
 }
 String kind;
 List args = invocation.positionalArguments;
 if (args == null) args = [];
 // TODO(vsm): Clean this up once InvocationMirrors settle down.  The 'get:'
 // and 'set:' form is still used by Dartium and the trunk version of
 // Dart2JS.
 if (invocation.isGetter) {
   kind = 'get';
   if (member.startsWith('get:')) {
     member = member.substring(4);
   }
 } else if (invocation.isSetter) {
   kind = 'set';
   if (member.endsWith('=')) {
     member = member.substring(0, member.length - 1);
   }
   if (member.startsWith('set:')) {
     member = member.substring(4);
   }
 } else if (member.startsWith('get:')) {
   kind = 'get';
   member = member.substring(4);
 } else if (member.startsWith('set:')) {
   kind = 'set';
   member = member.substring(4);
 } else if (member == 'call') {
   // A 'call' (probably) means that this proxy was invoked directly
   // as if it was a function.  Map this to JS function application.
   kind = 'apply';
 } else {
   kind = 'method';
 }
 return _forward(this, member, kind, args);
}

Proxy toJs() #

inherited from Proxy
Proxy toJs() => this;