javascript - how to override dojo function -


i'd correct problem of incorrect week number in dojox/calendar/calendar. know change => exports._getweekofyear function in dojo/date/locale

it works if put in js file, but, not want/cannot modify dojo's files.

i wanted apply overriding solutions found here:

http://g00glen00b.be/dojo-inheritance-overriding-extending/ or here

without success syntaxerror: missing : after property id

on line var obj = new exports();

code last try:

require(["dojo/_base/lang", "dojo/date/locale"], function(lang, locale){     lang.extend(locale, {         var obj = new exports();         obj._getweekofyear = function(/*date*/ dateobject, /*number*/ firstdayofweek){             if(arguments.length == 1){ firstdayofweek = 0; }             var determinedate = new date();             determinedate.setfullyear(dateobject.getfullyear(), dateobject.getmonth(), dateobject.getdate());             var d = determinedate.getday();             if(d == firstdayofweek) d = 7;             determinedate.setdate(determinedate.getdate() + (4 - d));             var yn = determinedate.getfullyear();             var zbdocy = math.floor((determinedate.gettime() - new date(yn, 0, 1, -6)) / 86400000);             var wn = 1 + math.floor(zbdocy / 7);             return wn;         };     }); }); 

i tried :

exports._getweekofyear: function(...)     exports._getweekofyear=: function(...) 

any ideas?

without supplying whole solution, first thing notice "exports" not class can instantiate using new keyword. in particular dojo module, exports object exposes api.

take @ solutions on sitepen, "monkeypatching" mechanism works me.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -