| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 {%- if use_new_js_bindings %} |
| 6 |
| 7 "use strict"; |
| 8 |
| 9 (function() { |
| 10 // TODO(yzshen): Define these aliases to minimize the differences between the |
| 11 // old/new modes. Remove them when the old mode goes away. |
| 12 var bindings = mojo; |
| 13 var codec = mojo.internal; |
| 14 var validator = mojo.internal; |
| 15 {%- for import in imports %} |
| 16 var {{import.unique_name}} = {{import.module.namespace}}; |
| 17 {%- endfor %} |
| 18 |
| 19 {% include "module_definition.tmpl" %} |
| 20 })(); |
| 21 |
| 22 {%- else %} |
| 23 |
| 5 define("{{module.path}}", [ | 24 define("{{module.path}}", [ |
| 6 {%- if module.path != | 25 {%- if module.path != |
| 7 "mojo/public/interfaces/bindings/interface_control_messages.mojom" and | 26 "mojo/public/interfaces/bindings/interface_control_messages.mojom" and |
| 8 module.path != | 27 module.path != |
| 9 "mojo/public/interfaces/bindings/pipe_control_messages.mojom" %} | 28 "mojo/public/interfaces/bindings/pipe_control_messages.mojom" %} |
| 10 "mojo/public/js/bindings", | 29 "mojo/public/js/bindings", |
| 11 {%- endif %} | 30 {%- endif %} |
| 12 "mojo/public/js/codec", | 31 "mojo/public/js/codec", |
| 13 "mojo/public/js/core", | 32 "mojo/public/js/core", |
| 14 "mojo/public/js/validator", | 33 "mojo/public/js/validator", |
| 15 {%- for import in imports %} | 34 {%- for import in imports %} |
| 16 "{{import.module.path}}", | 35 "{{import.module.path}}", |
| 17 {%- endfor %} | 36 {%- endfor %} |
| 18 ], function( | 37 ], function( |
| 19 {%- if module.path != | 38 {%- if module.path != |
| 20 "mojo/public/interfaces/bindings/interface_control_messages.mojom" and | 39 "mojo/public/interfaces/bindings/interface_control_messages.mojom" and |
| 21 module.path != | 40 module.path != |
| 22 "mojo/public/interfaces/bindings/pipe_control_messages.mojom" -%} | 41 "mojo/public/interfaces/bindings/pipe_control_messages.mojom" -%} |
| 23 bindings, {% endif -%} | 42 bindings, {% endif -%} |
| 24 codec, core, validator | 43 codec, core, validator |
| 25 {%- for import in imports -%} | 44 {%- for import in imports -%} |
| 26 , {{import.unique_name}} | 45 , {{import.unique_name}} |
| 27 {%- endfor -%} | 46 {%- endfor -%} |
| 28 ) { | 47 ) { |
| 29 | 48 |
| 30 {%- include "module_definition.tmpl" %} | 49 {%- include "module_definition.tmpl" %} |
| 31 | 50 |
| 32 return exports; | 51 return exports; |
| 33 }); | 52 }); |
| 53 |
| 54 {%- endif %} |
| OLD | NEW |