| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.js_emitter.headers; | 5 library dart2js.js_emitter.headers; |
| 6 import '../dart2jslib.dart' show Compiler; | 6 import '../compiler.dart' show Compiler; |
| 7 | 7 |
| 8 String generatedBy(Compiler compiler, {String flavor: ""}) { | 8 String generatedBy(Compiler compiler, {String flavor: ""}) { |
| 9 String suffix = ''; | 9 String suffix = ''; |
| 10 if (compiler.hasBuildId) suffix = ' version: ${compiler.buildId}'; | 10 if (compiler.hasBuildId) suffix = ' version: ${compiler.buildId}'; |
| 11 if (flavor != "") flavor = " ($flavor)"; | 11 if (flavor != "") flavor = " ($flavor)"; |
| 12 return '// Generated by dart2js$flavor, ' | 12 return '// Generated by dart2js$flavor, ' |
| 13 'the Dart to JavaScript compiler$suffix.'; | 13 'the Dart to JavaScript compiler$suffix.'; |
| 14 } | 14 } |
| 15 | 15 |
| 16 const String HOOKS_API_USAGE = """ | 16 const String HOOKS_API_USAGE = """ |
| 17 // The code supports the following hooks: | 17 // The code supports the following hooks: |
| 18 // dartPrint(message): | 18 // dartPrint(message): |
| 19 // if this function is defined it is called instead of the Dart [print] | 19 // if this function is defined it is called instead of the Dart [print] |
| 20 // method. | 20 // method. |
| 21 // | 21 // |
| 22 // dartMainRunner(main, args): | 22 // dartMainRunner(main, args): |
| 23 // if this function is defined, the Dart [main] method will not be invoked | 23 // if this function is defined, the Dart [main] method will not be invoked |
| 24 // directly. Instead, a closure that will invoke [main], and its arguments | 24 // directly. Instead, a closure that will invoke [main], and its arguments |
| 25 // [args] is passed to [dartMainRunner]. | 25 // [args] is passed to [dartMainRunner]. |
| 26 // | 26 // |
| 27 // dartDeferredLibraryLoader(uri, successCallback, errorCallback): | 27 // dartDeferredLibraryLoader(uri, successCallback, errorCallback): |
| 28 // if this function is defined, it will be called when a deferered library | 28 // if this function is defined, it will be called when a deferered library |
| 29 // is loaded. It should load and eval the javascript of `uri`, and call | 29 // is loaded. It should load and eval the javascript of `uri`, and call |
| 30 // successCallback. If it fails to do so, it should call errorCallback with | 30 // successCallback. If it fails to do so, it should call errorCallback with |
| 31 // an error. | 31 // an error. |
| 32 """; | 32 """; |
| OLD | NEW |