Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(738)

Unified Diff: sky/examples/stocks/stocks.sky

Issue 954513003: Wire in more-real stock data for stocks example. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« sky/examples/stocks/companylist.sky ('K') | « sky/examples/stocks/companylist.sky ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/stocks/stocks.sky
diff --git a/sky/examples/stocks/stocks.sky b/sky/examples/stocks/stocks.sky
index e27cde4bd2548fd3f55591c5830aade021a40163..a02728e4e929c19bf2265267a4dfa643111f51bc 100644
--- a/sky/examples/stocks/stocks.sky
+++ b/sky/examples/stocks/stocks.sky
@@ -6,7 +6,8 @@
<import src="/sky/framework/sky-drawer.sky" />
<import src="/sky/framework/sky-element.sky" />
<import src="/sky/framework/sky-scrollable.sky" />
-<import src="stock.sky" />
+<import src="stock.sky" as='view'/>
+<import src='companylist.sky' as='model'/>
<sky-element>
<template>
@@ -58,28 +59,7 @@
<div id="menu" />
I am a stocks app
</sky-toolbar>
- <sky-scrollable>
- <stock ticker="GOOG" />
- <stock ticker="GOOGL" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
- <stock ticker="GOOG" />
+ <sky-scrollable id='stock_list'>
</sky-scrollable>
</template>
<script>
@@ -93,6 +73,16 @@ class Stocks extends SkyElement {
_drawer = shadowRoot.getElementById('drawer');
Element menu = shadowRoot.getElementById('menu');
menu.addEventListener('click', _handleMenuClick);
+ populateStockList();
+ }
+
+ void populateStockList() {
+ Element stockList = shadowRoot.getElementById('stock_list');
+ // Limit to first 100 to avoid taking seconds to load.
+ for (var i = 0; i < 100; i++) {
+ model.Stock stock = model.oracle.stocks[i];
+ stockList.appendChild(new view.Stock()..ticker = stock.symbol);
+ }
}
void _handleMenuClick(_) {
« sky/examples/stocks/companylist.sky ('K') | « sky/examples/stocks/companylist.sky ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698