Constructor
new EzPromiseManager(form)
- Description:
콜백/프로미스 연계용 관리자
Example
this.promiseManager = new EzPromiseManager(this);
Parameters:
| Name | Type | Description |
|---|---|---|
form |
nexacro.FormBase |
Methods
cancel(id)
- Description:
특정 id의 Promise를 관리 해제한다.
Example
this.promiseManager = new EzPromiseManager(this);
var promm = this.promiseManager.newInstance("testId",function(e){
trace(e.data,"complete");
});
this.promiseManager.cancel("testId");
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | Promise의 고유 식별자 |
newInstance(id, cfn) → {Promise}
- Description:
새로운 Pomise 객체를 생성 이 함수를 통해 생성된 Promise는 Manager에 의해 관리됩니다.
Example
this.promiseManager = new EzPromiseManager(this);
var promm = this.promiseManager.newInstance("testId",function(e){
trace("test complete");
});
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
id |
string | Promise의 고유 식별자 |
||||||
cfn |
string | function | 콜백함수 Properties
|
Returns:
생성된 Promise객체
- Type
- Promise
reject(id, e) → {Promise}
- Description:
특정 id의 Promise를 reject한다.
Example
this.promiseManager = new EzPromiseManager(this);
var promm = this.promiseManager.newInstance("testId",function(e){
trace(e.data,"complete");
});
try{
//..[do someting]..
this.promiseManager.resolve("testId",{data : "test"});
}catch(e){
this.promiseManager.reject("testId",e);
}
Parameters:
| Name | Type | Description |
|---|---|---|
id |
String | Promise의 고유 식별자 |
e |
Error | 에러 정보 객체 |
Returns:
- Promise reject 결과
- Type
- Promise
resolve(id, e) → {Promise}
- Description:
특정 id의 Promise를 resolve한다.
Example
this.promiseManager = new EzPromiseManager(this);
var promm = this.promiseManager.newInstance("testId",function(e){
trace(e.data,"complete");
});
this.promiseManager.resolve("testId",{data : "test"});
Parameters:
| Name | Type | Description |
|---|---|---|
id |
string | Promise의 고유 식별자 |
e |
Object | 이벤트 정보 객체 |
Returns:
- Promise resolve 결과
- Type
- Promise