Commit e6a5e59e authored by Eric Seidel's avatar Eric Seidel

Wire in more-real stock data for stocks example.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/954513003
parent 545f6abb
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -6,7 +6,8 @@ ...@@ -6,7 +6,8 @@
<import src="/sky/framework/sky-drawer.sky" /> <import src="/sky/framework/sky-drawer.sky" />
<import src="/sky/framework/sky-element.sky" /> <import src="/sky/framework/sky-element.sky" />
<import src="/sky/framework/sky-scrollable.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> <sky-element>
<template> <template>
...@@ -58,28 +59,7 @@ ...@@ -58,28 +59,7 @@
<div id="menu" /> <div id="menu" />
I am a stocks app I am a stocks app
</sky-toolbar> </sky-toolbar>
<sky-scrollable> <sky-scrollable id='stock_list'>
<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> </sky-scrollable>
</template> </template>
<script> <script>
...@@ -93,6 +73,16 @@ class Stocks extends SkyElement { ...@@ -93,6 +73,16 @@ class Stocks extends SkyElement {
_drawer = shadowRoot.getElementById('drawer'); _drawer = shadowRoot.getElementById('drawer');
Element menu = shadowRoot.getElementById('menu'); Element menu = shadowRoot.getElementById('menu');
menu.addEventListener('click', _handleMenuClick); 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(_) { void _handleMenuClick(_) {
......
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