| 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:polymer/polymer.dart'; | |
| 8 | |
| 9 @CustomTag('curly-block') | |
| 10 class CurlyBlockElement extends PolymerElement { | |
| 11 CurlyBlockElement.created() : super.created(); | |
| 12 | |
| 13 @observable bool expanded = false; | |
| 14 @observable bool busy = false; | |
| 15 @published var callback = null; | |
| 16 @published bool expand = false; | |
| 17 | |
| 18 void expandChanged(oldValue) { | |
| 19 expanded = expand; | |
| 20 } | |
| 21 | |
| 22 void doneCallback() { | |
| 23 expanded = !expanded; | |
| 24 busy = false; | |
| 25 } | |
| 26 | |
| 27 void toggleExpand(var a, var b, var c) { | |
| 28 assert(callback == null || expand == false); | |
| 29 if (busy) { | |
| 30 return; | |
| 31 } | |
| 32 if (callback != null) { | |
| 33 busy = true; | |
| 34 callback(!expanded, doneCallback); | |
| 35 } else { | |
| 36 expanded = !expanded; | |
| 37 } | |
| 38 } | |
| 39 } | |
| OLD | NEW |