MCPcopy
hub / github.com/botui/botui / _addMessage

Function _addMessage

src/scripts/botui.js:229–251  ·  view source on GitHub ↗
(_msg)

Source from the content-addressed store, hash-verified

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') {

Callers 1

botui.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…