MCPcopy
hub / github.com/socketio/socket.io / addMessageElement

Function addMessageElement

examples/cluster-nginx/server/public/main.js:121–145  ·  view source on GitHub ↗
(el, options)

Source from the content-addressed store, hash-verified

119 // options.prepend - If the element should prepend
120 // all other messages (default = false)
121 function addMessageElement (el, options) {
122 var $el = $(el);
123
124 // Setup default options
125 if (!options) {
126 options = {};
127 }
128 if (typeof options.fade === 'undefined') {
129 options.fade = true;
130 }
131 if (typeof options.prepend === 'undefined') {
132 options.prepend = false;
133 }
134
135 // Apply options
136 if (options.fade) {
137 $el.hide().fadeIn(FADE_TIME);
138 }
139 if (options.prepend) {
140 $messages.prepend($el);
141 } else {
142 $messages.append($el);
143 }
144 $messages[0].scrollTop = $messages[0].scrollHeight;
145 }
146
147 // Prevents input from having injected markup
148 function cleanInput (input) {

Callers 2

logFunction · 0.70
addChatMessageFunction · 0.70

Calls 1

$Function · 0.50

Tested by

no test coverage detected