Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 /** | |
| 6 * Indicates that loading of [libraryName] is deferred. | |
| 7 * | |
| 8 * Applies to library imports. | |
| 9 * | |
| 10 * Example usage: | |
| 11 * | |
| 12 * [: | |
| 13 * @DeferLoad('com.example.foo') | |
| 14 * import 'foo.dart' as foo; | |
| 15 * | |
| 16 * void main() { | |
| 17 * foo.method(); // Warning: foo may not have been loaded. | |
| 18 * load('com.example.foo').then(onFooLoaded); | |
| 19 * } | |
| 20 * | |
| 21 * @OnLibraryLoaded('com.example.foo') | |
|
kasperl
2013/01/07 12:18:07
Maybe this would be better as WhenLibraryLoaded be
Sean Eagan
2013/01/14 15:57:52
Could the libraryName possibly default to the name
ahe
2013/01/14 16:17:37
It is the name of the library, not the prefix. Thi
| |
| 22 * void onFooLoaded(_) { | |
| 23 * foo.method(); // No warning. | |
| 24 * } | |
| 25 * :] | |
| 26 */ | |
|
gbracha
2013/01/07 17:40:15
1. The behavior of this annotation should be prope
| |
| 27 class DeferLoad { | |
| 28 final String libraryName; | |
| 29 | |
| 30 const DeferLoad(this.libraryName); | |
| 31 } | |
| 32 | |
| 33 /** | |
| 34 * Indicates that an element is not called until [libraryName] has | |
| 35 * been loaded. | |
| 36 * | |
| 37 * Applies to library declarations, classes, and functions. | |
| 38 */ | |
|
gbracha
2013/01/07 17:40:15
1. The comment says nothing about the semantics of
ahe
2013/01/08 07:19:48
I agree. What do you suggest we do instead?
| |
| 39 class OnLibraryLoaded { | |
| 40 final String libraryName; | |
| 41 | |
| 42 const OnLibraryLoaded(this.libraryName); | |
| 43 } | |
| 44 | |
| 45 /** | |
| 46 * Ensure that [libraryName] has been loaded. | |
| 47 * | |
| 48 * The returned future if this invocation of [load] caused the library | |
|
floitsch
2013/02/18 13:22:35
Comment seems incomplete.
| |
| 49 * to be loaded. | |
| 50 */ | |
| 51 external Future<bool> load(String libraryName, {String uri}); | |
|
Sean Eagan
2013/01/14 15:57:52
Does this Future throw some sort of error, e.g. Li
ahe
2013/01/14 16:17:37
Yes.
floitsch
2013/02/18 13:22:35
a top-level "load" sounds dangerous to me.
| |
| OLD | NEW |