equal
deleted
inserted
replaced
317 |
317 |
318 /** |
318 /** |
319 * Get an object given by name |
319 * Get an object given by name |
320 */ |
320 */ |
321 MyAMS.getObject = function (objectName, context) { |
321 MyAMS.getObject = function (objectName, context) { |
|
322 if (typeof(objectName) !== 'string') { |
|
323 return objectName; |
|
324 } |
322 if (!objectName) { |
325 if (!objectName) { |
323 return undefined; |
326 return undefined; |
324 } |
|
325 if (typeof(objectName) !== 'string') { |
|
326 return objectName; |
|
327 } |
327 } |
328 var namespaces = objectName.split("."); |
328 var namespaces = objectName.split("."); |
329 context = (context === undefined || context === null) ? window : context; |
329 context = (context === undefined || context === null) ? window : context; |
330 for (var i = 0; i < namespaces.length; i++) { |
330 for (var i = 0; i < namespaces.length; i++) { |
331 try { |
331 try { |
340 /** |
340 /** |
341 * Get and execute a function given by name |
341 * Get and execute a function given by name |
342 * Small piece of code by Jason Bunting |
342 * Small piece of code by Jason Bunting |
343 */ |
343 */ |
344 MyAMS.getFunctionByName = function (functionName, context) { |
344 MyAMS.getFunctionByName = function (functionName, context) { |
345 if (functionName === undefined) { |
345 if (typeof(functionName) === 'function') { |
|
346 return functionName; |
|
347 } |
|
348 if (!functionName) { |
346 return undefined; |
349 return undefined; |
347 } else if (typeof(functionName) === 'function') { |
|
348 return functionName; |
|
349 } |
350 } |
350 var namespaces = functionName.split("."); |
351 var namespaces = functionName.split("."); |
351 var func = namespaces.pop(); |
352 var func = namespaces.pop(); |
352 context = (context === undefined || context === null) ? window : context; |
353 context = (context === undefined || context === null) ? window : context; |
353 for (var i = 0; i < namespaces.length; i++) { |
354 for (var i = 0; i < namespaces.length; i++) { |