Load stocks data off the network

Instead of hard-coding the stock data in the Dart file, this CL moves the data
to a JSON file and loads that file over the network. This change improves load
time for the Stocks app from 3 seconds to 2 seconds.

Also, this CL removes shake-to-reload from the Stocks app because that also
slows down load time (due to the two module systems fighting each other).

R=rafaelw@chromium.org, ojan@chromium.org

Review URL: https://codereview.chromium.org/1021723005
This commit is contained in:
Adam Barth 2015-03-23 09:59:50 -07:00
parent 03a2006046
commit cc1c9cb9fc
4 changed files with 2988 additions and 2971 deletions

View File

@ -33,14 +33,18 @@ class StocksApp extends App {
${typography.white.title};'''
);
List<Stock> _sortedStocks;
List<Stock> _sortedStocks = [];
bool _isSearching = false;
bool _isShowingMenu = false;
String _searchQuery;
StocksApp() : super() {
_sortedStocks = oracle.stocks;
_sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol));
fetchStockOracle().then((oracle) {
setState(() {
_sortedStocks = oracle.stocks;
_sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol));
});
});
}
void _handleSearchClick(_) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,6 @@
// found in the LICENSE file.
-->
<sky>
<import src="/sky/framework/debug/shake-to-reload.sky" />
<script>
// TODO(abarth): Should this be package:stocks/stocks_app.dart?
import 'lib/stock_app.dart';