(_msg)
| 227 | var _instance = _botApp.$children[0]; // to access the component's data |
| 228 | |
| 229 | function _addMessage(_msg) { |
| 230 | |
| 231 | if(!_msg.loading && !_msg.content) { |
| 232 | throw Error('BotUI: "content" is required in a non-loading message object.'); |
| 233 | } |
| 234 | |
| 235 | _msg.type = _msg.type || 'text'; |
| 236 | _msg.visible = (_msg.delay || _msg.loading) ? false : true; |
| 237 | var _index = _instance.messages.push(_msg) - 1; |
| 238 | |
| 239 | return new Promise(function (resolve, reject) { |
| 240 | setTimeout(function () { |
| 241 | if(_msg.delay) { |
| 242 | _msg.visible = true; |
| 243 | |
| 244 | if(_msg.loading) { |
| 245 | _msg.loading = false; |
| 246 | } |
| 247 | } |
| 248 | resolve(_index); |
| 249 | }, _msg.delay || 0); |
| 250 | }); |
| 251 | } |
| 252 | |
| 253 | function _checkOpts(_opts) { |
| 254 | if(typeof _opts === 'string') { |
no outgoing calls
no test coverage detected
searching dependent graphs…