function - javascript: explain how to use certain class as static -


this question has answer here:

i have scrip structure:

define('game-logic/clib',[], function () {  var audio = null;  return {     //some functions....    localordef: function(name, def)    {        /....   },  }  }); 

and have no idea, how 'define' stuff on top works, want understand it, want rewrite script in such way, call functions clib.localordef(name,def), including other scripts using:

 "script type="text/javascript" src="js/clib.js"></script>" 

this 'define('game-logic/clib',[], function ()' - how replace call static class?

to keep simple - define keyword comes requirejs framework , used guarantee particular dependencies met when call them, e.g. jquery loaded when want use it. more info found on projects homepage: http://requirejs.org/

each module used requirejs written in amd way. more info found here: https://github.com/amdjs/amdjs-api/blob/master/amd.md

if want call functions in object way, use prototype. more info found e.g. here: http://javascriptissexy.com/javascript-prototype-in-plain-detailed-language/ or here: http://yehudakatz.com/2011/08/12/understanding-prototypes-in-javascript/


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -