Re: [JSMentors] Naming convention for constants

2012-01-12 Thread Poetro
sed as a constructor. So it doesn't matter what kind of guidelines you use, but use a really detailed one. You can even modify it to some degree to make it fit your team's development style (like switch camelCase to something else, or use Hungarian notation or whatever your team prefers

Re: [JSMentors] SAX vs DOM

2011-12-31 Thread Poetro
DOM like document during the SAX parsing. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubsc

Re: [JSMentors] Re: Now you see it, now you don't (please don't hide content by default)

2011-12-23 Thread Poetro
t;script"; >>     >> >>     >>     >>     >>     hear this >>     >>     .. >> >> Am I missing something here? If this works as expected, then >> why do major players like Google+ (don't get me started on >> T

Re: [JSMentors] List of great video lectures, articles and book in JavaScript ?

2011-12-06 Thread Poetro
pt/ > > > It deeply insults me the good parts is not on your top 3 list :( I personally dont like that book, and Stoyan Stefanov's book (JavaScript Patterns) talks about the same things (plus a lot more). So if you've read JavaScript Patterns then it The Good Parts wont too mu

Re: [JSMentors] Onload event is not getting fired for dynamic script loading

2011-12-06 Thread Poetro
nts on DOM mutations > (DOMNodeInserted, etc) and but those don't seem to hit either. Ok, it is inserted at the right place, but are you sure, that there will be a readstatechange event? Didn't it already fired by the time that you insert your script? Also if you ever looked up the jQuer

Re: [JSMentors] How do you automatically minify your client JS files?

2011-12-06 Thread Poetro
2011/12/6 Poetro : > Create a middleware. If the request is for a JS file compress it with > Uglify-js or similar, and then serve the compressed files instead. > Look at the Connect/Express middlewares, there might even be one that > does this for you. There you have it https:

Re: [JSMentors] How do you automatically minify your client JS files?

2011-12-06 Thread Poetro
Express middlewares, there might even be one that does this for you. off: posting a question to several list doesnt look to be a good idea. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via

Re: [JSMentors] Re: passing external resources like images, stylesheets, etc to a Node app

2011-11-26 Thread Poetro
hat it checks if a file exists before serving it? > > On Nov 25, 1:51 am, Poetro wrote: >> 2011/11/25 dtang85 : >> >> > Are there any good resources you can recommend for learning Node? The >> > documentation is a bit overwhelming. >> >> Node.js -ht

Re: [JSMentors] Re: passing external resources like images, stylesheets, etc to a Node app

2011-11-25 Thread Poetro
roduct/0636920021506.do Up and Running With Node.js - http://ofps.oreilly.com/titles/9781449398583/ Mastering Node (eBook) - http://visionmedia.github.com/masteringnode/ -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmento

Re: [JSMentors] passing external resources like images, stylesheets, etc to a Node app

2011-11-23 Thread Poetro
sponse.writeHead(200, { 'Content-type': 'text/css; charset=utf-8' }); // Pipe the file stream to the response. stream.pipe(response); } -- Poetro -- To view archived discussions from the original JSMentors Mailman list

Re: [JSMentors] passing external resources like images, stylesheets, etc to a Node app

2011-11-23 Thread Poetro
// On the stream end, end the response. stream.on('end', function () { response.end(); }); // Pipe the file stream to the response. stream.pipe(response); } else { render404(reques

Re: [JSMentors] Need help with this effect

2011-11-03 Thread Poetro
' }) }, function() { $(this).animate({ width: '-=100', height: '-=100', margin: '+=50' }) }); Demo: http://jsfiddle.net/Poetro/Q98Ax/1/ -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-

Re: [JSMentors] Need help with this effect

2011-11-03 Thread Poetro
2011/11/3 Rohit Mehta : > Thanks poetro..i knw the css part of it. The toggle function is clear to me > now.. I was confused with speed parameter in it and so mycode was not > working.. > > How to create the drag and drop and expanding boxes when clicked > ? If you still want

Re: [JSMentors] Need help with this effect

2011-11-03 Thread Poetro
nt to remove them, just unbind the click handlers from the element. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentor

Re: [JSMentors] Why my closure function don't hold the local variable value

2011-10-21 Thread Poetro
t[y]); }; } for (var x = 0; x < list.length; x++) { arrFun[x] = callback(x); } return arrFun; } -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: h

Re: [JSMentors] Why Scoping dont work for nested function

2011-10-21 Thread Poetro
ow do you think to put the label `nestedFunction` in the middle of a function. If you want nestedFunction to be a property of object4, you should either add it to the object literal as you did with `name` and `action`, or create it as `this.nestedFunction` or `this.action.nestedFunction`. -- Poetro -

Re: [JSMentors] Parser | Can I consider 1 + 1 + 1 as a single + operator?

2011-09-30 Thread Poetro
oo" "3boo" >>> var a = {toString: function () { return 1; }, valueOf: function () { return >>> 2; }}, b = 0; a + b 2 -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search

Re: [JSMentors] Re: Variable scope/timing issue w/ ajax within a JavaScript module

2011-09-15 Thread Poetro
e goes for AJAX loading. You specify a callback, that will be called when a the AJAX data is loaded. You even specify one callback for the 'complete' attribute, that will be called when the AJAX loading is 'complete'. -- Poetro -- To view archived discussions from

Re: [JSMentors] Variable scope/timing issue w/ ajax within a JavaScript module

2011-09-14 Thread Poetro
use jQuery already to fill in default values? http://api.jquery.com/jQuery.extend -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-ar

Re: [JSMentors] Learn "raw" WebGL

2011-09-11 Thread Poetro
led description on MDN https://developer.mozilla.org/en/WebGL. There is also a blog, with a bunch of tutorials only about WebGL at http://learningwebgl.com/ . And I'm also sure, that typing WebGL into your favorite search engine will give you fairly good results. -- Poetro -- To v

Re: [JSMentors] Newbie on a canvas 2d context question

2011-09-11 Thread Poetro
ery much in advance, > > Jane If you would have checked for the error, you would know, that there are a couple of issues that can trigger the error. http://stackoverflow.com/questions/2704929/uncaught-error-security-err-dom-exception-18 Mainly the issue could be that one of the images is on a diff

Re: [JSMentors] Should XmlHttpRequest Response Be HTML or JSON?

2011-09-11 Thread Poetro
n parsing a JSON string, and you only need to do the parsing once, since then it will be native. Although generating DOM from that JSON can be costly, but that also needs to be done once. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive

Re: [JSMentors] Re: WebGl shape recognition

2011-09-08 Thread Poetro
ing that if their examples > don't work from firefox it's probably alpha code. > > Patrick They worked for me in Firefox, Chrome, Opera and even IE9 if i set the appropiate HTML Doctype. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http:/

Re: [JSMentors] Fun interview question with function expressions

2011-09-07 Thread Poetro
able INSIDE the function, not outside of it (except for IE, which has a broken implementation of the spec). Read Dmitry Soshnikov's explanation on the subject. http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/#function-expression -- Poetro -- To view archived discussions from th

Re: [JSMentors] Fun interview question with function expressions

2011-09-06 Thread Poetro
2011/9/6 gaz Heyes : > On 6 September 2011 19:12, Poetro wrote: >> >> 2011/9/6 gaz Heyes : >> > I found this which was quite surprising: >> > >> > !function x(){x=123;alert(x);}() >> > >> > What's the value of x without running the

Re: [JSMentors] Fun interview question with function expressions

2011-09-06 Thread Poetro
run will result in a ReferenceError. In case of Fx the result will be REALLY weird, as it was a list of plugins for me. In IE it will most likely produce the number 123. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmen

Re: [JSMentors] spaces in attribute values

2011-09-06 Thread Poetro
>> can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 >> and higher, plus the hyphen (-) and the underscore (_); they cannot start >> with a >> digit, two hyphens, or a hyphen followed by a digit. -- Poetro -- To view archived discussions

Re: [JSMentors] spaces in attribute values

2011-09-06 Thread Poetro
e written with double quotes or with single quotes. Double > quotes cannot occur inside double quotes, unless escaped > (e.g., as '\"' or as '\22'). Analogously for single quotes (e.g., "\'" or > "\27"). -- Poetro -- To view archived disc

Re: [JSMentors] "Essentials of interpretation" Lesson 5. Simple user-defined functions.

2011-09-06 Thread Poetro
error Asen means: /^[A-Z_$][\w$]*$/i -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe fr

Re: [JSMentors] spaces in attribute values

2011-09-06 Thread Poetro
because it's not as though whitespace in > this situation can create syntactic confusion as a brace, "]", > delimits the whole selection. jQuery('[class="first last"]') works fine on and same should go for anything else. Same goes to jQuery('[

Re: [JSMentors] Re: Accessors in JavaScript

2011-09-02 Thread Poetro
l_Objects/Object/defineProperty https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/defineProperties -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google

Re: [JSMentors] Re: Accessors in JavaScript

2011-08-26 Thread Poetro
> var a = new XJSAccessors( o ); > console.log( o.set( 'p', 'v' ) );// 'v' > a.protect( 'p' ); > console.log( o.set( 'p', 'WHATEVER' ) );;// 'v' Why checking for undefined, why not check if it is in the object: return name in

Re: [JSMentors] Are anonymous objects created with new automatically garbage collected?

2011-08-23 Thread Poetro
colors[i] << ((l - i - 1) * 8) } return value; }, mult : function (val) { var i = 0, l = colors.length, output = 'rgba('; val = val > 1 ? 1 : val < 0 ? 0 : val; for (; i < l; i += 1) { output += Math.min(Math.round(this.colors[i] * val), 255) + ',&

Re: [JSMentors] changing the URL without a page refresh

2011-08-13 Thread Poetro
tInterval to check for the hash change (and also there are plugins / frameworks for that). -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.

Re: [JSMentors] Pre-blur event

2011-08-09 Thread Poetro
ment (in most cases the element that has blurred is passed along with the event), So don't disable the button, that is supposed to be clicked when your field looses focus. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/j

Re: [JSMentors] Re: Reading Java Script File contents

2011-08-02 Thread Poetro
2011/8/2 sim williams : > Thanks Poetro > > Would this be possible for cross domain files? > > Thanks > Only if both your browser and the third party do support cross domain ajax (http://www.w3.org/TR/XMLHttpRequest2/). In any other cases you would need a proxy (written in yo

Re: [JSMentors] URL Blocker

2011-08-02 Thread Poetro
There are several of those for every browser (and some browsers even have them integrated, like Opera) and operating system. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, v

Re: [JSMentors] Reading Java Script File contents

2011-08-02 Thread Poetro
2011/8/2 sim williams : > Hi All, > > I would like to be able to read the contents of a JavaScript file. You should load the file via AJAX, then you can read the content of the response. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http:/

Re: [JSMentors] Re: Best framework to small projects

2011-07-25 Thread Poetro
lution would be for this, is to modify / monkey patch the frameworks so they use a common utility library (like Underscore.js). -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google

Re: [JSMentors] "new" implementation

2011-07-16 Thread Poetro
ion of new using new is kind of weird... -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsub

Re: [JSMentors] JavaScript architecture

2011-07-12 Thread Poetro
e, like pubsub.publish('myevent', args) or pubsub.publish('myevent.mycomponent', args). Same goes for the unsubscribe. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google

Re: [JSMentors] Why this Global Object is not Found in the Firebug Console (Throws Error)

2011-07-04 Thread Poetro
unsubscribe from this group, send email to > jsmentors+unsubscr...@googlegroups.com > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/jsmentors@jsmentors.com/ > > To search via a non-Google archive, visit here: &g

Re: [JSMentors] Why this Global Object is not Found in the Firebug Console (Throws Error)

2011-07-04 Thread Poetro
To be able to use it, you have to use the global context for it, namely window.debug each and every time, or you will be calling Firebug's debug function, as that is the current scope. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www

Re: [JSMentors] Re: Why this Global Object is not Found in the Firebug Console (Throws Error)

2011-07-04 Thread Poetro
debug is a convinence function in firebug so you may not be able to overwrite it, or get it to user your user defined function. http://getfirebug.com/wiki/index.php/Command_Line_API#debug.28fn.29 -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http

Re: [JSMentors] Re: Parameters vs. Objects as Parameters

2011-07-04 Thread Poetro
jsdoc-toolkit [http://code.google.com/p/jsdoc-toolkit/] already has an approach to mark up object parameters in the form of: /** * @param userInfo Information about the user. * @param userInfo.name The name of the user. * @param userInfo.email The email of the user. */ -- Poetro -- To

Re: [JSMentors] Detect focus of an iframe

2011-07-01 Thread Poetro
rent or semi transparent div on top of everything, that covers the whole page, and put your overlay above that. The div could would handle all the click events and react to it. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.c

Re: [JSMentors] SICP-style streams, and the Sieve of Eratosthenes

2011-06-30 Thread Poetro
); while (n--) { console.log(fib.next()); } }(10)); }}} Output: {{{ 1 2 3 5 8 13 21 34 55 89 }} -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http

Re: [JSMentors] SICP-style streams, and the Sieve of Eratosthenes

2011-06-30 Thread Poetro
------ }}} I dont know how do you like this approach, but it is what is kindof the closest thing to JavaScript. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google arch

Re: [JSMentors] Re: Parameters vs. Objects as Parameters

2011-06-18 Thread Poetro
returning null), so the rest of the script doesnt really run. http://jsperf.com/parameters-incidence/2 should give better results. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google

Re: [JSMentors] Post using XMLHttpRequest

2011-06-15 Thread Poetro
params.push(encodeURIComponent(m) + '=' + encodeURIComponent(data[m])); } } return params; } xhr.send(params({key1: 'value', key2: value}).join('&')); -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mai

Re: [JSMentors] Code structuring and why...

2011-06-13 Thread Poetro
atterns by Addy Osmani <http://addyosmani.com/blog/essentialjsdesignpatterns> and there are books like Pro JavaScript Design Patterns, JavaScript Patterns. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To searc

Re: [JSMentors] Spreadsheet view in rails + share options

2011-06-13 Thread Poetro
in every JavaScript framework. For jQuery there is the jqGrid and DataTables plugins, there is one for ExtJS and most probably any framework you can find that has a recent version will have one. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.

Re: [JSMentors] Congratz on becoming a windows programmer

2011-06-02 Thread Poetro
e the AMD videocard drivers' Control Center is written in .NET which have access to the registry, drivers, hardware, and the same API can be accessed NOW with JScript.NET. This only looks to me as the next step in that process. -- Poetro -- To view archived discussions from the original JSM

Re: [JSMentors] HTML11

2011-06-01 Thread Poetro
2011/6/2 Andrew Dodson : > I was looking at http://www.html11.org/ > And wondered if the element will expose a save() method with a > callback handler. This is a joke right? -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-ar

Re: [JSMentors] Re: When to use prototype to extend a function?

2011-05-25 Thread Poetro
window object. Right? > Please give me a heads up I'm not really sure whats happening here... > Regards In case the a new object is created by calling new MyClass1 Then the context inside MyClass1 would change a newly initialized object. If you call it with just MyClass1() then the `

Re: [JSMentors] Re: Detect that window is maximized

2011-05-19 Thread Poetro
entWidth && screen.height === > docEl.clientHeight; > } > > Matt > This can have issues in case of multiple screens. Opera and Internet Explorer always returns the width/height of the primary screen, while Firefox and Chrome returns it for the screen the window is currently on

Re: [JSMentors] Detect that window is maximized

2011-05-18 Thread Poetro
antin I don't think it is a good UX if/when an application resizes my windows. Also the popups are also a bad thing and should only be used if there is no other way to implement something (I'd doubt). -- Poetro -- To view archived discussions from the original JSMentors Mai

Re: [JSMentors] Re: UTF-8 to Unicode conversion in ajax response

2011-05-17 Thread Poetro
What HTTP headers does your server side script sends to the client? Does it send the right Content-type header along with a charset? -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non

Re: [JSMentors] How to access Object.prototype from Object.prototype.b.c()?

2011-05-17 Thread Poetro
ble: false }); -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to

Re: [JSMentors] How to access Object.prototype from Object.prototype.b.c()?

2011-05-17 Thread Poetro
would be: Object.defineProperty(Array.prototype, 'b', { get: function () { var array = this; array.c = function () { console.log(array); return array; } return array; }, set: function () {}, enumerable: false }); myArray.b.c(); -- Poetro -- To view

Re: [JSMentors] Updating emilejs to include fix for opacity in IE

2011-05-04 Thread Poetro
To search via a non-Google archive, visit here: > http://www.mail-archive.com/jsmentors@googlegroups.com/ > > To unsubscribe from this group, send email to > jsmentors+unsubscr...@googlegroups.com > I just started to add opacity for you, but it is kind of complicated. Anyways, here's a

Re: [JSMentors] Re: is need to manually set some local var to 'null'?

2011-04-28 Thread Poetro
ere an object is bind to a native element and vice-versa. This can create a circular reference, which can result in a memory leak. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non

Re: [JSMentors] Blog post on closures in JavaScript

2011-04-26 Thread Poetro
ning of the function, the position of the definition doesnt really matter. So I dont really understand what you mean by this. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google arc

Re: [JSMentors] Object name

2011-04-19 Thread Poetro
{ console.log(this) }); callJSONP(url, callbackName); -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To un

Re: [JSMentors] how to get cookie DSID ?

2011-04-19 Thread Poetro
that pulls the DSID from the url? > > Thanks! > Jim > Cookies are saved to a file. If you can figure out where your browser saves that cookie file, write a script that parses those cookie files, and collect that DSID whatever that is. -- Poetro -- To view archived discussions fr

Re: [JSMentors] Just how efficient are JS function calls?

2011-04-14 Thread Poetro
2011/4/14 Rob Steward : > Hi all, short time lurker and first time poster. > > I just started writing a new tools library, and one of the methods is > some syntactic sugar that allows you to manipulate the DOM and include > a javascript file in the head element. > > [code] > function include(files)

Re: [JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Poetro
2011/4/13 Scott Sauyet : > Poetro wrote: >>     win = window.open('javascript:"' + encodeURIComponent(message) + >> '"', yourwindow), >>     doc = window.document; > > presumably `doc = win.document`, right? Ah yes, tnx for finding the typ

Re: [JSMentors] Re: Best practices for opening new window (pop up or pop under) with JavaScript

2011-04-13 Thread Poetro
27;"', yourwindow), doc = window.document; doc.write('' + message + '' + message + ''); doc.close(); And then when some event happens, just: win.location.replace('http://www.example.com/'); -- Poetro -- To view archi

Re: [JSMentors] Object(null)

2011-04-03 Thread Poetro
2011/4/2 Dmitry A. Soshnikov : > On 03.04.2011 1:38, Poetro wrote: >> >> 2011/3/29 alexis: >>> >>> var k = null; >>> Object(k) === k -->  false (in Chrome and FF4). >>> >>> I don't understand how this behavior is consistent with

Re: [JSMentors] Object(null)

2011-04-02 Thread Poetro
? Object(k) returns a new object whatever k was it doesn't mind. And object is not equal to anything except itself. console.log(Object(null)); // Object console.log(null); // Object -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-arch

Re: [JSMentors] Re: How to implement Promises?

2011-03-29 Thread Poetro
ted at http://wiki.commonjs.org/wiki/Promises/A#Implementations ? And also you can look at the jQuery implementation at https://github.com/jquery/jquery/blob/master/src/deferred.js . -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-arch

Re: [JSMentors] Re: Problem removing event listener?

2011-03-28 Thread Poetro
within the object? Is that a > efficient way of doing things? > M. I've made a somewhat small even handler, with which you can add and remove events. I collect a list of all event handlers for reference, so that they can be easily removed later on. Check it out at https://github.com/Poet

Re: [JSMentors] How to implement Promises?

2011-03-27 Thread Poetro
by reading the CommonJS Promises proposals some light might come. http://wiki.commonjs.org/wiki/Promises . Also there you can see implementations for some of the proposals. Also you may want to check out chain.js https://github.com/chriso/chain.js that is a chaniable system to handle async callba

Re: [JSMentors] Problem removing event listener?

2011-03-23 Thread Poetro
these situations ? > > Sent from my iPhone > > On 23 Mar 2011, at 13:36, Poetro wrote: > >> 2011/3/22 Mark McDonnell : >>> I'm having a bizarre issue removing an event listener (this occurs in both >>> Firefox and Chrome). >>> >>> If

Re: [JSMentors] Best practices concerning references inside nested objects

2011-03-23 Thread Poetro
o); }, replyBar: function () { console.log(app.bar); } }, doSomeThing: function (){ app.callbackLib.replyFoo(); app.callbackLib.replyBar(); } } app.doSomeThing(); Although this would trigger errors in the following case: bar = app; app = {}; bar.doSomeThing(); As app i

Re: [JSMentors] Problem removing event listener?

2011-03-23 Thread Poetro
clickHandler, false); Creating anonymous functions each time creates 2 different functions, so you cannot remove it, as u haven't added that, but a different function, that has the same implementation. Just think of: var a = {}, b = {}; alert(a === b); // false -- Poetro -- To view archived di

Re: [JSMentors] Re: Post/repo on small something to help with checking for object "conformance"

2011-03-22 Thread Poetro
https://github.com/garycourt/JSV -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from

Re: [JSMentors] Re: Extending built-in objects with properties

2011-03-21 Thread Poetro
ge at a future point (in an OS upgrade), or on some devices it behaves differently, you still need to start from the kitchen sink. Like relying on if the browser is IE then it cannot do certain things, but as IE9 came out, a bunch of applications are now broken, because they think, that IE behave

Re: [JSMentors] accessing global variable in a callback

2011-03-21 Thread Poetro
understand, so, as expected window.gRT.inspect doesn't work; neither does > GLOBAL.gRT.inspect. > > Is there something I'm not understanding about global scope? -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/j

Re: [JSMentors] Edge cases with function declarations

2011-03-17 Thread Poetro
r even exist, because it should only exist Sadly in JScript (Microsoft's JavaScript implementation) the g will be created, and hoisted. See the article http://dmitrysoshnikov.com/ecmascript/chapter-5-functions/#nfe-and-jscript by Dmitry A. Soshnikov. -- Poetro -- To view archived discussions

Re: [JSMentors] I need help with garbage collection!

2011-03-01 Thread Poetro
one get garbage collected. The 2 buttons refence to an object, The object is still there, although the _rotator variable is not. If you want to get rid of the object, get rid of all the references to it. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http:

Re: [JSMentors] ES5: Object.keys and Object.getOwnPropertyNames

2011-03-01 Thread Poetro
ted in ES5). -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, sen

Re: [JSMentors] stdin and stdout

2011-02-24 Thread Poetro
, _readImpl and _writeImple for instance. > _writeWatcher and _readWatcher both take two arguments that look like > key:value pairs. Most probably you should not use _writeWatcher and _readWatcher functions, as they are 'private'. Just use the functions that are available in th

Re: [JSMentors] Re: Module pattern and testability

2011-02-17 Thread Poetro
the page above. Like ActionScript, C++, Python etc. have their own design patterns that solves issues that are common in those languages. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Googl

Re: [JSMentors] Image pre-loading

2011-02-16 Thread Poetro
here wont be a high need of frameworks that abstract event handling or AJAX. I think this is one similar case. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit her

Re: [JSMentors] Image pre-loading

2011-02-16 Thread Poetro
I > can see the image in the network resource of the web-inspector. But somehow, > its not being read in my JS. Why not create some setTimeout in the onload handler, that will run until there is some height / width of the item? If it doesn't get a height / width in the next 5 second consid

Re: [JSMentors] The Node.Js is here and is growing, where's microsoft?

2011-02-14 Thread Poetro
as no progress in it since July 2010. But according to what is already done, this is doable in the .NET environment, although I don't know too much about it. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmen

Re: [JSMentors] Wicket Creation Suggestions, Patterns

2011-02-08 Thread Poetro
quot;); }, updateText: function(text) { var rulePanel = Ext.get("RulePanel"); if (rulePanel) { rulePanel.update(text); } } } I think it s clean and simple. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-a

Re: [JSMentors] "new Number(...)" use case

2011-02-04 Thread Poetro
; following and it successfully renders 0.00 in the UI > > (new Number(0)).toFixed(2) You can either use (0).toFixed(2) There is maybe a speed difference between the two (hard to tell which is faster), but I wont think about speed here, but then number of trasferred bytes is less for sure. --

Re: [JSMentors] $('body') vs $(document) in Pub/Sub pattern

2011-02-03 Thread Poetro
I dont think that there would be other difference. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/

Re: [JSMentors] JavaScript must die

2011-01-30 Thread Poetro
page without previous notice of the site developer. Oh, and also kill document.write as it is not secure and slow. But these are mainly issues of the BOM / DOM not the language itself. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com

Re: [JSMentors] The "const" keyword in JavaScript

2011-01-21 Thread Poetro
cuments they read at MDN. > It is even marked as bold. And also it is stated in the Statement table: Implemented in: JavaScript 1.5, NES 6.0 (Netscape extension, C engine only) -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentor

Re: RE: [JSMentors] using new with Wrappers

2011-01-15 Thread Poetro
nd right? It depends on the view of what is considered a property or method. >>> console.log(typeof "string".replace) function >>> console.log((1.23456).toFixed(2)) 1.23 >>> console.log("what is my".length) 10 It looks to me that primitives ha

Re: [JSMentors] jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-14 Thread Poetro
ment per function` function aaa() { var x; Date(); if (x) { aaa(); } var y; x = y; } -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www

Re: [JSMentors] jslint "Move all 'var' declarations to the top of the function." is now a critical error

2011-01-14 Thread Poetro
`var` declarations in just turn of that check. It is totally optional. Maybe you are using a broken implementation. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, vi

Re: [JSMentors] function name property

2011-01-14 Thread Poetro
It doesnt print for me anything in Opera, Chrome or Node.js, While IE8 prints "undefined". -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www

Re: [JSMentors] setInterval overhead

2011-01-14 Thread Poetro
2011/1/14 Peter van der Zee : > Certain browsers have a minimal interval at which timers can be called. For > example, firefox has 10ms intervals. So timers simply can't be called faster > than ten times per second. You must have meant 100 times per second. -- Poetro -- To

Re: [JSMentors] JS API Design - Accepting Parameters

2011-01-13 Thread Poetro
Support both. If you are hesitant, you can support both ways. Take the jQuery API for example. It supports optional arguments, and depending on the type of the arguments they behave differently. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http

Re: [JSMentors] timer for HTML5 video player/jQuery

2011-01-10 Thread Poetro
function initVideoProgress() { function formatTime(time, fragments) { var output = '', fragment; // Maximize the fragments in 3. fragments = Math.max(1, Math.min(3, fragments || 3)); // For every fragment generate output. while (fragments--) { if (output) { outpu

Re: [JSMentors] Request for code review: noodles - Async/non-blocking/CPS versions of the higher order functions on `Array.prototype`

2011-01-09 Thread Poetro
mpressible. -- Poetro -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to

  1   2   >