OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 var foo = new JsThing('made in JS'); | 5 var foo = new JsThing('made in JS'); |
6 var aString = 'hello'; | 6 var aString = 'hello'; |
7 var aNum = 123; | 7 var aNum = 123; |
8 var aBool = true; | 8 var aBool = true; |
9 var a = null; | 9 var a = null; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 return hasName.name; | 36 return hasName.name; |
37 } | 37 } |
38 | 38 |
39 function roundTrip(e) { | 39 function roundTrip(e) { |
40 return e; | 40 return e; |
41 } | 41 } |
42 | 42 |
43 function isNull(value) { | 43 function isNull(value) { |
44 return value === null; | 44 return value === null; |
45 } | 45 } |
46 | |
47 // hand-generated export code derived from test.dart | |
48 | |
49 window.dart = window.dart || {}; | |
50 | |
51 window.dart.Object = function DartObject() { | |
52 throw "not allowed"; | |
53 }; | |
54 | |
55 window.dart.Object._wrapDartObject = function(dartObject) { | |
56 var o = Object.create(window.dart.Object.prototype); | |
57 o.__dart_object__ = dartObject; | |
58 return o; | |
59 }; | |
60 | |
61 _export_dart_test(dart); | |
62 | |
63 function _export_dart_test(parent) { | |
64 var lib = parent.test = {}; | |
65 _export_dart_test_library(lib); | |
66 } | |
67 | |
68 function _export_dart_test_library(parent) { | |
69 var lib = parent.library = {}; | |
70 _export_test_library_ExportMe(lib); | |
71 } | |
72 | |
73 function _export_test_library_ExportMe(parent) { | |
74 var constructor = parent.ExportMe = function ExportMeJs() { | |
75 this.__dart_object__ = constructor._new(); | |
76 }; | |
77 constructor.prototype = Object.create(dart.Object.prototype); | |
78 constructor.prototype.constructor = constructor; | |
79 constructor._wrapDartObject = function(dartObject) { | |
80 var o = Object.create(constructor.prototype); | |
81 o.__dart_object__ = dartObject; | |
82 return o; | |
83 }; | |
84 | |
85 // named constructor | |
86 constructor.named = function ExportMeJs(name) { | |
87 this.__dart_object__ = constructor._new_named(name); | |
88 }; | |
89 constructor.named.prototype = constructor.prototype; | |
90 } | |
OLD | NEW |