MCPcopy
hub / github.com/serversideup/amplitudejs / run

Function run

src/utilities/callbacks.js:200–229  ·  view source on GitHub ↗

* Runs a user defined callback method * * Public Accessor: Callbacks.run( callbackName ) * * @access public * @param {string} callbackName - The name of the callback we are going to run.

(callbackName)

Source from the content-addressed store, hash-verified

198 * @param {string} callbackName - The name of the callback we are going to run.
199 */
200 function run(callbackName) {
201 /*
202 Checks to see if a user defined a callback method for the
203 callback we are running.
204 */
205 if (config.callbacks[callbackName]) {
206 /*
207 Build the callback function
208 */
209 let callbackFunction = config.callbacks[callbackName];
210
211 /*
212 Write a debug message stating the callback we are running
213 */
214 Debug.writeMessage("Running Callback: " + callbackName);
215
216 /*
217 Run the callback function and catch any errors
218 */
219 try {
220 callbackFunction();
221 } catch (error) {
222 if (error.message == "CANCEL EVENT") {
223 throw error;
224 } else {
225 Debug.writeMessage("Callback error: " + error.message);
226 }
227 }
228 }
229 }
230
231 return {
232 initialize: initialize,

Callers 1

initializeFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected