Commit cc1c9cb9 authored by Adam Barth's avatar Adam Barth

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
parent 03a20060
...@@ -33,14 +33,18 @@ class StocksApp extends App { ...@@ -33,14 +33,18 @@ class StocksApp extends App {
${typography.white.title};''' ${typography.white.title};'''
); );
List<Stock> _sortedStocks; List<Stock> _sortedStocks = [];
bool _isSearching = false; bool _isSearching = false;
bool _isShowingMenu = false; bool _isShowingMenu = false;
String _searchQuery; String _searchQuery;
StocksApp() : super() { StocksApp() : super() {
fetchStockOracle().then((oracle) {
setState(() {
_sortedStocks = oracle.stocks; _sortedStocks = oracle.stocks;
_sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol));
});
});
} }
void _handleSearchClick(_) { void _handleSearchClick(_) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
// found in the LICENSE file. // found in the LICENSE file.
--> -->
<sky> <sky>
<import src="/sky/framework/debug/shake-to-reload.sky" />
<script> <script>
// TODO(abarth): Should this be package:stocks/stocks_app.dart? // TODO(abarth): Should this be package:stocks/stocks_app.dart?
import 'lib/stock_app.dart'; import 'lib/stock_app.dart';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment