I was late to the game with JavaScript promises, but I'm onboard now. Let's talk about promises a little bit and see if we can make things clearer for future reference.
Recently at work I had to work out some logic to make absolutely sure that some code didn't run until all of the JavaScript files were loaded. I'd like to share the solution with you just in case you need it, or more likely when I need it as a reference down the road. However it lands, here we go...
For those of you who don't already know, I'm a big-time Star Trek fan. I'm especially interested in the original series, and some of my favorite content comes from an old role-playing game from a company called FASA in the 1980's. The game had an extensive timeline of events, and I've always wanted an easier way to read through it. Since I grew up to be a web developer, the obvious choice is to build an app!
If you have more than one data source for your AngularJS app, then you'll need them all completed before the thing runs. Although this is a common problem, solutions can be hard to find on the Unhelpful Interwebs. But don't worry, I promise we can solve it.
Today we're going to listen to some buttons from a parent element, and we're not going to use jQuery. We're going to use vanilla JavaScript. I still love me some jQuery, of course, but we don't gain a deeper understanding of JavaScript unless we dig into it a little bit and let go of our favorite tools.
For the past good long while, I've been using a throttled function to do various JavaScript chores when the browser fires a resize event. It's a good way to correct the heights of things or add a class when the window hits a certain size. That's been fine for a while, but recently I found a need to upgrade things.
I've been playing around with Ye Olde Canvas again. This time I wanted to use several techniques in one animation, including the Page Visibility API, and combine those with some behaviors outside of the canvas itself. I also wanted to put an Easter egg into my site. Because Spider-Man.
Recently I spent a rather large amount of time working on a silly star map that no one is likely to ever look at until after I’m famous and long dead, when it will be uncovered by digital archaeologists and mistaken for primitive astronomy. I have a point, I swear. Just give me a moment to process my thoughts.
If you remember the Star Trek Role-playing Game from FASA, then you'll remember how good the writing was. The game developers had everything figured out, right down to the coordinates for different planets and the actual speeds of the various warp factors. I've made a cute little utility to work out the time it takes to go from here to there at a given speed.
I've been wanting to make some little something with CreateJS for a while now, but I was always studying things that related to my day-job. Now that the contract is over and I'm looking for a new position, I had a little time to try a little coding exercise. I created a sub-class for the framework's Shape() class, and I've played around with the animation a bit. The results are actually very promising. Have a look at the source code for some details on how it works.
For those of you who learned Flash before JavaScript, the HTML5 Canvas can seem a little weird. But don't worry, there's a framework available to help you make the transition. It's called CreateJS, it's backed by Adobe and it's completely open.
A while back I built a silly little performance-testing animation that I called “Bouncer”. It's nice, but I noticed recently that it was missing a vital component: an indication of the frame rate. I added one this morning, and I thought I would share the code with you.