| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library curly_block_element; | |
| 6 | |
| 7 import 'package:logging/logging.dart'; | |
| 8 import 'package:polymer/polymer.dart'; | |
| 9 | |
| 10 @CustomTag('curly-block') | |
| 11 class CurlyBlockElement extends PolymerElement { | |
| 12 CurlyBlockElement.created() : super.created(); | |
| 13 | |
| 14 @observable bool expanded = false; | |
| 15 @observable bool busy = false; | |
| 16 @published var callback = null; | |
| 17 | |
| 18 void doneCallback() { | |
| 19 print("done callback"); | |
| 20 expanded = !expanded; | |
| 21 busy = false; | |
| 22 } | |
| 23 | |
| 24 void toggleExpand(var a, var b, var c) { | |
| 25 if (busy) { | |
| 26 return; | |
| 27 } | |
| 28 if (callback != null) { | |
| 29 busy = true; | |
| 30 callback(!expanded, doneCallback); | |
| 31 } else { | |
| 32 expanded = !expanded; | |
| 33 } | |
| 34 } | |
| 35 } | |
| OLD | NEW |