1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 2 // for details. All rights reserved. Use of this source code is governed by a 3 // BSD-style license that can be found in the LICENSE file. 4 5 // Generated from namespace: functions 6 7 part of chrome; 8 9 /** 10 * Types 11 */ 12 13 class FunctionsDictType extends ChromeObject { 14 /* 15 * Private constructor 16 */ 17 FunctionsDictType._proxy(_jsObject) : super._proxy(_jsObject); 18 19 /* 20 * Public accessors 21 */ 22 /// A field. 23 int get a => JS('int', '#.a', this._jsObject); 24 25 void set a(int a) { 26 JS('void', '#.a = #', this._jsObject, a); 27 } 28 29 30 /* 31 * Methods 32 */ 33 /// A parameter. 34 void voidFunc() => JS('void', '#.voidFunc()', this._jsObject); 35 36 } 37 38 /** 39 * Functions 40 */ 41 42 class API_functions { 43 /* 44 * API connection 45 */ 46 Object _jsObject; 47 48 /* 49 * Functions 50 */ 51 /// Simple function. 52 void voidFunc() => JS('void', '#.voidFunc()', this._jsObject); 53 54 /// Function taking a non-optional argument. 55 void argFunc(String s) => JS('void', '#.argFunc(#)', this._jsObject, s); 56 57 /// Function taking an optional argument. 58 void optionalArgFunc([String s]) => JS('void', '#.optionalArgFunc(#)', this._jsObject, s); 59 60 /// Function taking a non-optional dictionary argument. 61 void dictArgFunc(FunctionsDictType d) => JS('void', '#.dictArgFunc(#)', this._jsObject, convertArgument(d)); 62 63 /// Function taking an optional dictionary argument. 64 void optionalDictArgFunc([FunctionsDictType d]) => JS('void', '#.optionalDictArgFunc(#)', this._jsObject, convertArgument(d)); 65 66 /// Function taking an entry argument. 67 void entryArgFunc(Object entry) => JS('void', '#.entryArgFunc(#)', this._jsObject, convertArgument(entry)); 68 69 /// Function taking a simple callback. 70 void callbackFunc(void c()) => JS('void', '#.callbackFunc(#)', this._jsObject, convertDartClosureToJS(c, 0)); 71 72 /// Function taking an optional simple callback. 73 void optionalCallbackFunc([void c()]) => JS('void', '#.optionalCallbackFunc(#)', this._jsObject, convertDartClosureToJS(c, 0)); 74 75 /// Function taking a primitive callback. 76 void primitiveCallbackFunc(void c(int i)) => JS('void', '#.primitiveCallbackFunc(#)', this._jsObject, convertDartClosureToJS(c, 1)); 77 78 /// Function taking a dictionary callback. 79 void dictCallbackFunc(void c(DictType dict)) { 80 void __proxy_callback(dict) { 81 if (c != null) { 82 c(new DictType._proxy(dict)); 83 } 84 } 85 JS('void', '#.dictCallbackFunc(#)', this._jsObject, convertDartClosureToJS(__proxy_callback, 1)); 86 } 87 88 /// Function returning a dictionary. 89 FunctionsDictType dictRetFunc() => new FunctionsDictType._proxy(JS('', '#.dictRetFunc()', this._jsObject)); 90 91 API_functions(this._jsObject) { 92 } 93 } 94