From 047db87a25ea4c9bbc9c4a7bfffe68b8aba9c840 Mon Sep 17 00:00:00 2001 From: shmyga Date: Fri, 17 Jul 2015 21:36:55 +0300 Subject: [PATCH] promise in popup --- src/main/haxework/gui/popup/PopupView.hx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/haxework/gui/popup/PopupView.hx b/src/main/haxework/gui/popup/PopupView.hx index d90c55e..117abb1 100755 --- a/src/main/haxework/gui/popup/PopupView.hx +++ b/src/main/haxework/gui/popup/PopupView.hx @@ -1,7 +1,6 @@ package haxework.gui.popup; -import haxework.net.callback.Callback; -import haxework.net.callback.ICallback; +import promhx.Deferred; import haxe.Timer; import haxework.provider.Provider; import haxework.dispath.Dispatcher; @@ -15,7 +14,7 @@ class PopupView extends GroupView { private var buttonId:String; private var contentView:V; - private var callback:ICallback; + private var deferred:Deferred; public function new(contentViewFactory:Class) { super(); @@ -34,10 +33,10 @@ class PopupView extends GroupView { close(); } - public function show():ICallback { + public function show():Deferred { Provider.get(PopupManager).show(this); - callback = Callback.build(); - return callback; + deferred = new Deferred(); + return deferred; } public function close():Void { @@ -49,9 +48,9 @@ class PopupView extends GroupView { } public function onClose():Void { - if (callback != null) { - callback.callSuccess(buttonId); - callback = null; + if (deferred != null) { + deferred.resolve(buttonId); + deferred = null; } } }