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