Tagged Questions
9
votes
3answers
188 views
Updating Grid on Webpage (new version)
Task:
Draw a grid with a given number of rows and columns. Each cell can be
any color. The same grid should also be updated at a predetermined
time interval. The grid should cover the entire ...
8
votes
2answers
650 views
Javascript based product customization app
http://duc.pagodabox.com/product.php
I'm developing a JS based app that allows you to customize a product. I still consider myself a super newbie to javascript and especially to object oriented ...
7
votes
1answer
134 views
interactive slider
Task:
Create an interactive slider that allows the user to view a given image gallery.
Slider controls:
See previous slide
See next slide
Quick navigation through the images / Paging - ...
6
votes
2answers
192 views
Reusable Ajax object
I've been working on a new project and I've found myself needing to make multiple Ajax calls, often on the same page and at the same time. I decided rather than repeating code that I would try and ...
6
votes
2answers
162 views
Improving a JS object “framework”
I have this simple object setup in JavaScript - Full code on jsbin
I'll break it up below, but the question(s) -
Does it break? I mean, I'm sure we can find a interesting case where this would be ...
6
votes
3answers
292 views
Responsive module and tooltip module
Recently, I've noticed that my code looks so ugly because there were a bunch of functions and global variables. So, I started reading a little bit about design patterns. Now I come with something ...
5
votes
2answers
116 views
Updating Grid on Webpage
Task:
Draw a grid with a given number of rows and columns. Each cell can be
any color. The same grid should also be updated at a predetermined
time interval. The grid should cover the ...
5
votes
3answers
115 views
Object inheritance
I have written some example code to test object inheritance, but I'm not sure if it's really the best way for an object to inherit another's functions (like Java's ...
5
votes
1answer
49 views
Object construction differences
Whenever I create a Javascript "class" I do something like this:
...
5
votes
1answer
169 views
Object Oriented JavaScript optimization
This is a simple script that I use for wrapping a selected word in a textarea field. I'm looking to:
make sure my logic is valid/see what others have done in a relative context.
request ...
5
votes
1answer
181 views
Should I encapsulate my fields differently?
I wanted an excuse to do some OO JavaScript and I decided to do a JSON editor. It will basically allow you to input JSON and either collapse objects to see other objects better, delete objects (can ...
4
votes
3answers
380 views
Basic JavaScript OOP model object
I'm relatively new to JavaScript OOP and would like to know the best practice when doing a simple object such as a Model.
Here's a piece of code representing class named "Child".
What I'm asking for ...
4
votes
1answer
52 views
Should I differentiate object types by calling methods via variables?
I have three JavaScript objects. The first one serves merely as a prototype. The other two are implementation of a specific type.
...
4
votes
1answer
827 views
Javascript PriorityQueue based on object property
I am pretty new to javascript development and its temperaments. I wrote this class which is a priority queue based on a numeric property of any object. As far as I can tell, the following code is ...
4
votes
1answer
67 views
Object Oriented vs Not jQuery & JS
I have taken a widget/ plugin that I wrote yesterday and just now it has been re-written in an object oriented format. It is certainly more code to write it the OO way, so please let me know also how ...
4
votes
2answers
657 views
Review my simple javascript canvas game
Here is a link to the code on jsfiddle.
http://jsfiddle.net/caimen/kMkrW/
This is my first attempt at playing with canvas. Things I am looking for. Before I move on doing anything else it would be ...
4
votes
1answer
76 views
javascript canvas -javascript design
I am doing some tests with html5 Canvas object. At the same time I am trying to make my javascript code more modular. In the following code, where/how should I declare canvas and context, so that it ...
3
votes
3answers
348 views
JavaScript (multiple) inheritance / mixins
I'm quite new to JavaScript, and I'm trying to understand the idea behind inheritance in JavaScript. I've read a bit about it, and I don't want to mess with prototypes (which I don't yet fully ...
3
votes
2answers
214 views
Learning OOP javascript - critique my class that creates a 'favourites' list
I'm trying to improve my javascript coding style and want to start writing my code more object-oriented. The code below is getting a JSON-stringified list of locations from a cookie and appending a ...
3
votes
1answer
76 views
How could I have approached this responsive image gallery differently?
This gallery uses the Orbit gallery from the Foundation framework (version 3). I've set it up so that on smaller screens it appears as an accordion.
It works just fine, but is there a more concise ...
3
votes
1answer
147 views
Implementation of Javascript Classes and Inheritance
I've created a simple Javascript library to be able to create "classes" and extend them defining instance and static methods and variables.
It consists in a simple function Class with two methods: ...
3
votes
3answers
1k views
Please review my first Object Oriented JavaScript/jQuery Code
This is my first script in Object Oriented Javascript (jQuery 1.5.2). It's purpose is to simply validate a form (nothing fancy at the moment just checks if any value is present on required fields) and ...
3
votes
2answers
1k views
My Memory Game “Engine”
Mostly for the experience (but also so I could waste hours playing it), I made a simple memory card game in JavaScript. I built it so it has a backbone framework that could be easily extended by ...
3
votes
1answer
120 views
The eternal dilemma: bar.foo() or foo(bar)?
I was using foo(bar) as it's adopted for functional programming.
...
3
votes
1answer
32 views
Re-writing rough JS code with loads of jQuery plugins
I want to include about 10 jQuery plugins in a project but do so in a better way than just pasting them into a JS file.
I want to capture various device data and other data passed from the ...
3
votes
1answer
52 views
Utility object for setTimeout
I was using setTimeouts for a project where a callback will be called after a duration, but the user has the options of extending, pausing or stopping the timeout. I felt using the default setTimeout ...
3
votes
1answer
367 views
3
votes
1answer
201 views
JavaScript/PHP file uploader
I'm writing a JavaScript/PHP file uploader and I want to start this project off on the right track. I've started with this, a JavaScript Uploader object which will ...
2
votes
2answers
75 views
2
votes
1answer
67 views
Prototype OO-style of my THREE.JS application
For several months I'm working with JavaScript and THREE.JS library. Firstly I dislike the prototype-based programming because I have to work a lot of with ...
2
votes
1answer
138 views
Is my JavaScript OOP style correct?
I have done the following code for testing a web-service.
Is my style correct for using OOP in JavaScript?
...
2
votes
1answer
214 views
Minesweeper clone in jQuery
This was my first attempt at writing object-oriented JavaScript. It's a Minesweeper clone in jQuery. I thought I had done an ok job, but I've just received some feedback stating that it wasn't written ...
2
votes
2answers
100 views
How to get two JavaScript classes to talk to each other?
I'm a budding JavaScript programmer, working on an exercise where I'm trying to create two classes (Books and Shelf) and need to ...
2
votes
2answers
84 views
Object in JavaScript, superfluous?
I've got a JavaScript object and I am not sure how to implement the last part: adding up all of the prices and putting that in the last row of the table. Besides this question, I would also like to ...
2
votes
1answer
47 views
Organise site's module
I was wondering about on how to organise the code on my site, to make it clearer as possible and clearly readable.
I'm organising it with namespace, separating ...
2
votes
1answer
47 views
Making one object the property of another whilst avoiding scope issues
After being inspired by some MVC style design patterns, I have been trying to separate data from views in my code and move toward a more sensibly organized object based approach. (please, don't bother ...
2
votes
1answer
62 views
Looking to optimize Node.js Chat service
I've built a simple chat server/client on Node.js and socket.io that I would like reviewed. My main concern is making the chat.js (client) running as cleanly as possible (OO) and streamlining data ...
2
votes
1answer
216 views
Deleting a table row in JavaScript with OOP
I started learning OOP in JavaScript at school and I have to do my homework in OOP. It is a shopping list, one fills in a product and price and that is put into an array, the array its contents are ...
2
votes
2answers
43 views
Link to a parent object
I have a couple of nested objects, where A is always a part of B.
May I use the following code to access owner's properties and methods?
...
1
vote
2answers
84 views
Trying to use “this” to refer to a class's instance variable inside a function within the class's method in JavaScript
Hope that title makes sense.
This is part of an object I have:
The event listener attaches to the correct marker passed in the parameter but inside the function, ...
1
vote
4answers
844 views
Javascript effective code structure
What would be the best (performance, memory wise) to achieve a clean way to create a class or some way to properly structure the code, that shares 2 variables (req, res) which have a decent object ...
1
vote
1answer
132 views
javascript multiple inheritance code review
i had made a small code snippet for multiple inheritance in js. this code is working for me but actually i like to get the review, that its good and if any problem; provide the solution. etc. the code ...
1
vote
1answer
358 views
Placing and removing a dynamic tooltip
I'm making a calendar and this is one part of the larger project. This adds a tooltip with more information when a calendar event is clicked. It then disappears after 10 seconds, or earlier if a click ...
1
vote
1answer
277 views
1
vote
1answer
151 views
“metaconstructors” for inheritance in js?
Edit - decl smokes dojo.declare - http://jsperf.com/dojo-declare-vs-decl
The code has been updated a bit. ...
1
vote
1answer
35 views
Simple inheritance with functions in subclasses [closed]
It seems like there are many ways implementing inheritance in JavaScript. Which version do you prefer or would you suggest another solution?
The code should run in IE8+ so my first version would not ...
1
vote
1answer
68 views
object oriented Node.js class RiddleInfo.js
So I am trying to make a Object oriented Node.js class for store information about riddles.
Please feel free to be harsh as possible. Would love to hear your ideas about how to make this class better!
...
1
vote
1answer
52 views
1
vote
2answers
259 views
Dynamically create object
I am developing a web-application and I am encountering some trouble :
I have some tabs and each one contains input forms with different values. I need to switch beetween these tabs and see the ...
1
vote
1answer
102 views
Is this a good JavaScript class?
I'm trying to get my head around object oriented programming, and I'm starting in JavaScript. I have put a working demo of my code on JSFiddle (here), but the class is below.
My main concerns are ...