| 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 part of dart._runtime; | 4 part of dart._runtime; |
| 5 | 5 |
| 6 /// This library defines a set of general javascript utilities for us | 6 /// This library defines a set of general javascript utilities for us |
| 7 /// by the Dart runtime. | 7 /// by the Dart runtime. |
| 8 // TODO(ochafik): Rewrite some of these in Dart when possible. | 8 // TODO(ochafik): Rewrite some of these in Dart when possible. |
| 9 | 9 |
| 10 final defineProperty = JS('', 'Object.defineProperty'); | 10 final defineProperty = JS('', 'Object.defineProperty'); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 return $to; | 95 return $to; |
| 96 })()'''); | 96 })()'''); |
| 97 | 97 |
| 98 /// Copy properties from source to destination object. | 98 /// Copy properties from source to destination object. |
| 99 /// This operation is commonly called `mixin` in JS. | 99 /// This operation is commonly called `mixin` in JS. |
| 100 copyProperties(to, from) => JS('', '''(() => { | 100 copyProperties(to, from) => JS('', '''(() => { |
| 101 return $copyTheseProperties($to, $from, $getOwnNamesAndSymbols($from)); | 101 return $copyTheseProperties($to, $from, $getOwnNamesAndSymbols($from)); |
| 102 })()'''); | 102 })()'''); |
| 103 | |
| 104 /// Exports from one Dart module to another. | |
| 105 @JSExportName('export') | |
| 106 export_(to, from, show, hide) => JS('', '''(() => { | |
| 107 if ($show == void 0 || $show.length == 0) { | |
| 108 $show = $getOwnNamesAndSymbols($from); | |
| 109 } | |
| 110 if ($hide != void 0) { | |
| 111 var hideMap = new Set($hide); | |
| 112 $show = $show.filter((k) => !hideMap.has(k)); | |
| 113 } | |
| 114 return $copyTheseProperties($to, $from, $show); | |
| 115 })()'''); | |
| OLD | NEW |