| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /** | 5 /** |
| 6 * This defines a class for loading locale data incrementally from | 6 * This defines a class for loading locale data incrementally from |
| 7 * an external source as JSON. The external sources expected are either | 7 * an external source as JSON. The external sources expected are either |
| 8 * local files or via HTTP request. | 8 * local files or via HTTP request. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 library lazy_locale_data; | 11 library lazy_locale_data; |
| 12 import 'dart:async'; | 12 import 'dart:async'; |
| 13 import 'dart:uri'; | |
| 14 import 'intl_helpers.dart'; | 13 import 'intl_helpers.dart'; |
| 15 import 'dart:json' as json; | 14 import 'dart:json' as json; |
| 16 | 15 |
| 17 /** | 16 /** |
| 18 * This implements the very basic map-type operations which are used | 17 * This implements the very basic map-type operations which are used |
| 19 * in locale lookup, and looks them up based on a URL that defines | 18 * in locale lookup, and looks them up based on a URL that defines |
| 20 * the external source. | 19 * the external source. |
| 21 */ | 20 */ |
| 22 class LazyLocaleData { | 21 class LazyLocaleData { |
| 23 /// This holds the data we have loaded. | 22 /// This holds the data we have loaded. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 104 } |
| 106 | 105 |
| 107 /** | 106 /** |
| 108 * Given a Future [input] whose value is expected to be a string in JSON form, | 107 * Given a Future [input] whose value is expected to be a string in JSON form, |
| 109 * return another future that parses the JSON into a usable format. | 108 * return another future that parses the JSON into a usable format. |
| 110 */ | 109 */ |
| 111 Future jsonData(Future input) { | 110 Future jsonData(Future input) { |
| 112 return input.then( (response) => json.parse(response)); | 111 return input.then( (response) => json.parse(response)); |
| 113 } | 112 } |
| 114 } | 113 } |
| OLD | NEW |