blob: adc00603ac9f1856fa55995230693e12abc9d175 [file] [log] [blame]
// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
library dart2js.js_emitter.headers;
import '../options.dart';
String generatedBy(CompilerOptions options, {String flavor: ""}) {
String suffix = '';
if (options.hasBuildId) {
suffix = ' version: ${options.buildId}';
}
if (flavor != "") flavor = " ($flavor)";
return '// Generated by dart2js$flavor, '
'the Dart to JavaScript compiler$suffix.';
}
const String HOOKS_API_USAGE = """
// The code supports the following hooks:
// dartPrint(message):
// if this function is defined it is called instead of the Dart [print]
// method.
//
// dartMainRunner(main, args):
// if this function is defined, the Dart [main] method will not be invoked
// directly. Instead, a closure that will invoke [main], and its arguments
// [args] is passed to [dartMainRunner].
//
// dartDeferredLibraryLoader(uri, successCallback, errorCallback):
// if this function is defined, it will be called when a deferred library
// is loaded. It should load and eval the javascript of `uri`, and call
// successCallback. If it fails to do so, it should call errorCallback with
// an error.
//
// dartCallInstrumentation(id, qualifiedName):
// if this function is defined, it will be called at each entry of a
// method or constructor. Used only when compiling programs with
// --experiment-call-instrumentation.
//
// defaultPackagesBase:
// Override the location where `package:` uris are resolved from. By default
// they are resolved under "packages/" from the current window location.
""";