Skip to main content

All Questions

2 votes
1 answer
336 views

JavaScript copy-to-clipboard class

I am have made a small copy-to-clipboard script. I have made a method called copyToClipboard that does the following: create an input box; read the content of an ...
Razvan Zamfir's user avatar
5 votes
3 answers
411 views

Wrap a js function with a fixed this arg

If I use node.addEventListener('click',Wyg.Editor.nodeClickedEvent); then when node is clicked, ...
Reed's user avatar
  • 239
2 votes
0 answers
51 views

Event handler re-use in Javascript

I've been trying to deal with a lot of duplicate code in the first web pages I've been working on and have been playing around with the prototype model, which I think is the 'right' way to go about it....
S Meredith's user avatar
2 votes
1 answer
803 views

Event emitter in JavaScript without using Node's built in class or any additional libraries

I need to create this eventEmitter class with the functions listed below. I think I could clean the code a little but don't really know where to start. ...
Sua Morales's user avatar
3 votes
1 answer
48 views

JavaScript idle managing structure

I am just getting into the world of javascript, coming from the world of classical inheritance. The following is a library I wrote to track when a webapp is idling and I wrote it like I write ...
mattNit's user avatar
  • 33
3 votes
2 answers
600 views

Custom event handler in Javascript

In my web projects I often need a simple way to trigger callbacks defined somewhere else. Leaving jQuery finally behind me, I was missing their simple event system and tried to create my own. I'd like ...
Moritz Friedrich's user avatar
4 votes
1 answer
132 views

YouTube video intro, and autoscroll when video ends

This code creates an intro video using the Youtube API, screen text written by JavaScript with a typewriter kind of effect. How can I rewrite this as succinct object-oriented code? Also, I'm not sure ...
steveBK's user avatar
  • 177
4 votes
0 answers
84 views

Comparison of sprite movement implementations

I've come up with two ways to do sprite movement with CreateJS, and I'm wondering if one is better than the other as far as performance and maintainability. The player data is saved in a json file ...
Big McLargeHuge's user avatar
7 votes
1 answer
548 views

Custom event hub

I'm creating an event hub object in for a large project I am building in JavaScript. The project will have modules in charge of the UI, commands, and rendering. Each module will use this hub for ...
Robin's user avatar
  • 201
6 votes
1 answer
3k views

Navigation bar built from fetched JSON data

I have finally been able to create my little navigation plugin in an object-oriented way that reads the li from a JSON file. Now, is my code efficient? Especially, ...
angular_learner's user avatar
1 vote
1 answer
2k views

Is this use of JavaScript prototype functions for attaching event listeners going to meet design goals?

Please provide a sanity check on my below JavaScript pattern to be used for a custom edit control. The goals are: Centralized code Avoid name collisions Minimize memory use (putting functions on ...
Karl's user avatar
  • 111