Created
December 14, 2013 02:12
-
-
Save terrasea/7954850 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<polymer-element name="store-changes-load" attributes="count"> | |
<template> | |
<style> | |
:host { | |
display: none; | |
} | |
</style> | |
</template> | |
<script type="application/dart" src="store_changes_load.dart"></script> | |
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="import" href="store-changes-load.html"> | |
<polymer-element name="store-changes"> | |
<template> | |
<style> | |
div { | |
font-size: 24pt; | |
text-align: center; | |
margin-top: 140px; | |
} | |
button { | |
font-size: 24pt; | |
margin-bottom: 20px; | |
} | |
</style> | |
<div> | |
<span>(item count: {{count}})</span> | |
<store-changes-load count="{{count}}"></store-changes-load> | |
</div> | |
</template> | |
<script type="application/dart" src="store_changes.dart"></script> | |
</polymer-element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:polymer/polymer.dart'; | |
/** | |
* A Polymer click counter element. | |
*/ | |
@CustomTag('store-changes') | |
class StoreChanges extends PolymerElement { | |
@observable int count = 0; | |
StoreChanges.created() : super.created() { | |
} | |
@override | |
enteredView() { | |
super.enteredView(); | |
count.changes.listen((ChangeRecord change) { | |
print(change.toString()); | |
}); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:polymer/polymer.dart'; | |
import 'dart:async'; | |
/** | |
* A Polymer click counter element. | |
*/ | |
@CustomTag('store-changes-load') | |
class StoreChangesLoad extends PolymerElement { | |
@published int count; | |
StoreChangesLoad.created() : super.created() { | |
} | |
@override | |
void enteredView() { | |
super.enteredView(); | |
new Timer.periodic( | |
new Duration(milliseconds: 900), | |
(t){ | |
count++; | |
print(count.toString()); | |
} | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sample app</title> | |
<link rel="stylesheet" href="test.css"> | |
<!-- import the click-counter --> | |
<link rel="import" href="packages/test/store-changes.html"> | |
<script type="application/dart">export 'package:polymer/init.dart';</script> | |
<script src="packages/browser/dart.js"></script> | |
</head> | |
<body> | |
<h1>Test</h1> | |
<div id="sample_container_id"> | |
<store-changes></store-changes> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment