| 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 * var foo; | 248 * var foo; |
| 249 * | 249 * |
| 250 * main() { | 250 * main() { |
| 251 * JS_EFFECT((_){ foo = _; }) | 251 * JS_EFFECT((_){ foo = _; }) |
| 252 * } | 252 * } |
| 253 * | 253 * |
| 254 * TODO(sra): Replace this hack with something to mark the volatile or | 254 * TODO(sra): Replace this hack with something to mark the volatile or |
| 255 * externally initialized elements. | 255 * externally initialized elements. |
| 256 */ | 256 */ |
| 257 void JS_EFFECT(Function code) { code(null); } | 257 void JS_EFFECT(Function code) { code(null); } |
| 258 |
| 259 /** |
| 260 * Use this class for creating constants that hold JavaScript code. |
| 261 * For example: |
| 262 * |
| 263 * const constant = JS_CONST('typeof window != "undefined"); |
| 264 * |
| 265 * This code will generate: |
| 266 * $.JS_CONST_1 = typeof window != "undefined"; |
| 267 */ |
| 268 class JS_CONST { |
| 269 String code; |
| 270 const JS_CONST(this.code); |
| 271 } |
| OLD | NEW |