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, when used as metadata. | |
9 * | |
10 * Example usage: | |
11 * | |
12 * [: | |
13 * @lazy | |
kasperl
2013/02/18 13:53:08
So lazy is a user-chosen name now. Neat. Maybe we
ahe
2013/02/18 14:32:11
I would use "lazyFoo", but I'll let other people h
| |
14 * import 'foo.dart' as foo; | |
15 * | |
16 * const lazy = const DeferredLibrary('com.example.foo'); | |
17 * | |
18 * void main() { | |
19 * foo.method(); // Throws a NoSuchMethodError, foo is not loaded yet. | |
20 * lazy.load().then(onFooLoaded); | |
21 * } | |
22 * | |
23 * void onFooLoaded(_) { | |
24 * foo.method(); | |
25 * } | |
26 * :] | |
27 */ | |
28 class DeferredLibrary { | |
29 final String libraryName; | |
30 final String uri; | |
31 | |
32 const DeferLoad(this.libraryName, {this.uri}); | |
kasperl
2013/02/18 13:53:08
DeferredLibrary
ahe
2013/02/18 14:32:11
Done.
| |
33 | |
34 /** | |
35 * Ensure that [libraryName] has been loaded. | |
36 * | |
37 * The value of the returned future is true if this invocation of | |
38 * [load] caused the library to be loaded. | |
39 */ | |
40 external Future<bool> load(); | |
41 } | |
OLD | NEW |