atomSurfaceJsLine function

String atomSurfaceJsLine(
  1. String key,
  2. List<String> verbs
)

Emits the host.<key>.<verb> surface for one atom.

Implementation

String atomSurfaceJsLine(String key, List<String> verbs) {
  final buf = StringBuffer();
  buf.writeln("host['$key'] = host['$key'] || {};");
  for (final v in verbs) {
    buf.writeln(
      "host['$key']['$v'] = function() { "
      "return __hostCall('$key', '$v', "
      'Array.prototype.slice.call(arguments)); };',
    );
  }
  return buf.toString();
}