OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library _foreign_helper; | 5 library _foreign_helper; |
6 | 6 |
7 /** | 7 /** |
8 * Emits a JavaScript code fragment parameterized by arguments. | 8 * Emits a JavaScript code fragment parameterized by arguments. |
9 * | 9 * |
10 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order | 10 * Hash characters `#` in the [codeTemplate] are replaced in left-to-right order |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 get isolateStatics; | 121 get isolateStatics; |
122 } | 122 } |
123 | 123 |
124 /** | 124 /** |
125 * Invokes [function] in the context of [isolate]. | 125 * Invokes [function] in the context of [isolate]. |
126 */ | 126 */ |
127 JS_CALL_IN_ISOLATE(isolate, Function function) {} | 127 JS_CALL_IN_ISOLATE(isolate, Function function) {} |
128 | 128 |
129 /** | 129 /** |
130 * Converts the Dart closure [function] into a JavaScript closure. | 130 * Converts the Dart closure [function] into a JavaScript closure. |
| 131 * |
| 132 * Warning: This is no different from [RAW_DART_FUNCTION_REF] which means care |
| 133 * must be taken to store the current isolate. |
131 */ | 134 */ |
132 DART_CLOSURE_TO_JS(Function function) {} | 135 DART_CLOSURE_TO_JS(Function function) {} |
133 | 136 |
134 /** | 137 /** |
135 * Returns a raw reference to the JavaScript function which implements | 138 * Returns a raw reference to the JavaScript function which implements |
136 * [function]. | 139 * [function]. |
137 * | 140 * |
138 * Warning: this is dangerous, you should probably use | 141 * Warning: this is dangerous, you should probably use |
139 * [DART_CLOSURE_TO_JS] instead. The returned object is not a valid | 142 * [DART_CLOSURE_TO_JS] instead. The returned object is not a valid |
140 * Dart closure, does not store the isolate context or arity. | 143 * Dart closure, does not store the isolate context or arity. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 * | 268 * |
266 * const constant = JS_CONST('typeof window != "undefined"); | 269 * const constant = JS_CONST('typeof window != "undefined"); |
267 * | 270 * |
268 * This code will generate: | 271 * This code will generate: |
269 * $.JS_CONST_1 = typeof window != "undefined"; | 272 * $.JS_CONST_1 = typeof window != "undefined"; |
270 */ | 273 */ |
271 class JS_CONST { | 274 class JS_CONST { |
272 final String code; | 275 final String code; |
273 const JS_CONST(this.code); | 276 const JS_CONST(this.code); |
274 } | 277 } |
OLD | NEW |