This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
public function matches(source : *, ...values):void { | |
const len : uint = values.length; | |
// Walk through the supplied values and look for a match. | |
for (var i : uint = 0; i < len; i++) { | |
if (source === values[i]) { | |
return true; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This doesn't appear to be the case... | |
define(function (require) { | |
// Is there any guarantee that `moduleA` is loaded first? | |
var loadMeFirst = require('moduleA'); | |
var loadMeSecond = require('moduleB'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Wrap everything in an IIFE to avoid any globals leaking out. | |
(function (global) { | |
// Object Prototype, all instances created via 'matrix22' factory method will | |
// inherit from this object. | |
var matrix22Proto = { | |
zero: function() { | |
for (var i = 0; i < this.m.length; ++i) { | |
this.m[i] = 0.0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<link rel="stylesheet" href="http://code.jquery.com/qunit/git/qunit.css" type="text/css" media="screen" /> | |
<!-- when.js Promises implementation --> | |
<script src="https://raw.github.com/cujojs/when/master/when.js"></script> | |
<!-- Unit testing and mocking framework --> | |
<script type="text/javascript" src="http://code.jquery.com/qunit/git/qunit.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global require, define */ | |
define(function (require) { | |
"use strict"; | |
var slice = Array.prototype.slice; | |
// Simple logging shim which allows log messages to be filtered and redirected to a logging solution | |
// of your choice when debugging. | |
var Logger = { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script data-main="usage" src="http://requirejs.org/docs/release/1.0.8/comments/require.js"></script> | |
</head> | |
<body> | |
<p>Check your JavaScript console for output!</p> | |
</body> | |
</head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function create() : FacebookBaseAppRequestMarshaller | |
{ | |
if (_appRequest is TargettedAppRequest) | |
{ | |
return new FacebookTargettedAppRequestMarshaller(_appRequest as TargettedAppRequest, _payloadSerializer) | |
} | |
else if (_appRequest is FriendSelectorAppReqeust) | |
{ | |
return new FacebookFriendSelectorAppRequestMarshaller(_appRequest as FriendSelectorAppReqeust, _payloadSerializer); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.jonnyreeves | |
{ | |
import flash.display.Loader; | |
import flash.events.ErrorEvent; | |
import flash.events.Event; | |
import flash.events.EventDispatcher; | |
import flash.events.IEventDispatcher; | |
import flash.events.IOErrorEvent; | |
import flash.events.SecurityErrorEvent; | |
import flash.net.URLRequest; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package uk.co.jonnyreeves.puremvc | |
{ | |
import flash.errors.IllegalOperationError; | |
import org.puremvc.as3.multicore.interfaces.INotification; | |
/** | |
* Maps a PureMVC Notification to a Function delegate. Add the mappings in your Mediator's Constructor and then | |
* delegate the calls to listNotificationInterests() and handleNotification() through to this class. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I'm not a great fan of this as it violates the Law of Demeter. | |
facade.registerMediator(new BalanceDisplayMediator(appView.profileDisplay.balanceComponent)); | |
facade.registerMediator(new ProfileDisplayMediator(appView.profileDisplay)); | |
// Perhaps it's better to register the 'BalanceDisplayMediator' inside the 'ProfileDisplayMediator' instead? :S |