123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- 'use strict';
- const Q = require('q');
- module.exports = class CoaObject {
- constructor(cmd) {
- this._cmd = cmd;
- this._name = null;
- this._title = null;
- this._comp = null;
- }
-
- name(name) {
- this._name = name;
- return this;
- }
-
- title(title) {
- this._title = title;
- return this;
- }
-
- comp(comp) {
- this._comp = comp;
- return this;
- }
-
- apply(fn) {
- arguments.length > 1?
- fn.apply(this, [].slice.call(arguments, 1))
- : fn.call(this);
- return this;
- }
-
- reject(reason) {
- return Q.reject(reason);
- }
-
- end() {
- return this._cmd;
- }
- };
|