dist/ember.prod.js in ember-source-1.9.0.beta.4 vs dist/ember.prod.js in ember-source-1.9.0
- old
+ new
@@ -3,29 +3,34 @@
* @copyright Copyright 2011-2014 Tilde Inc. and contributors
* Portions Copyright 2006-2011 Strobe Inc.
* Portions Copyright 2008-2011 Apple Inc. All rights reserved.
* @license Licensed under MIT license
* See https://raw.github.com/emberjs/ember.js/master/LICENSE
- * @version 1.9.0-beta.4
+ * @version 1.9.0
*/
(function() {
var enifed, requireModule, eriuqer, requirejs, Ember;
(function() {
Ember = this.Ember = this.Ember || {};
if (typeof Ember === 'undefined') { Ember = {}; };
+ function UNDEFINED() { }
if (typeof Ember.__loader === 'undefined') {
var registry = {}, seen = {};
enifed = function(name, deps, callback) {
registry[name] = { deps: deps, callback: callback };
};
requirejs = eriuqer = requireModule = function(name) {
- if (seen.hasOwnProperty(name)) { return seen[name]; }
+ var s = seen[name];
+
+ if (s !== undefined) { return seen[name]; }
+ if (s === UNDEFINED) { return undefined; }
+
seen[name] = {};
if (!registry[name]) {
throw new Error("Could not find module " + name);
}
@@ -33,38 +38,41 @@
var mod = registry[name];
var deps = mod.deps;
var callback = mod.callback;
var reified = [];
var exports;
+ var length = deps.length;
- for (var i=0, l=deps.length; i<l; i++) {
+ for (var i=0; i<length; i++) {
if (deps[i] === 'exports') {
reified.push(exports = {});
} else {
- reified.push(requireModule(resolve(deps[i])));
+ reified.push(requireModule(resolve(deps[i], name)));
}
}
- var value = callback.apply(this, reified);
- return seen[name] = exports || value;
+ var value = length === 0 ? callback.call(this) : callback.apply(this, reified);
- function resolve(child) {
- if (child.charAt(0) !== '.') { return child; }
- var parts = child.split("/");
- var parentBase = name.split("/").slice(0, -1);
+ return seen[name] = exports || (value === undefined ? UNDEFINED : value);
+ };
- for (var i=0, l=parts.length; i<l; i++) {
- var part = parts[i];
+ function resolve(child, name) {
+ if (child.charAt(0) !== '.') { return child; }
+ var parts = child.split("/");
+ var parentBase = name.split("/").slice(0, -1);
- if (part === '..') { parentBase.pop(); }
- else if (part === '.') { continue; }
- else { parentBase.push(part); }
- }
+ for (var i=0, l=parts.length; i<l; i++) {
+ var part = parts[i];
- return parentBase.join("/");
+ if (part === '..') { parentBase.pop(); }
+ else if (part === '.') { continue; }
+ else { parentBase.push(part); }
}
- };
+
+ return parentBase.join("/");
+ }
+
requirejs._eak_seen = registry;
Ember.__loader = {define: enifed, require: eriuqer, registry: registry};
} else {
enifed = Ember.__loader.define;
@@ -9256,10 +9264,14 @@
@for Ember.String
@static
@return {Handlebars.SafeString} a string that will not be html escaped by Handlebars
*/
function htmlSafe(str) {
+ if (str === null || str === undefined) {
+ return "";
+ }
+
if (typeof str !== 'string') {
str = ''+str;
}
return new Handlebars.SafeString(str);
}
@@ -12757,11 +12769,11 @@
The core Runtime framework is based on the jQuery API with a number of
performance optimizations.
@class Ember
@static
- @version 1.9.0-beta.4
+ @version 1.9.0
*/
if ('undefined' === typeof Ember) {
// Create core object. Make it act like an instance of Ember.Namespace so that
// objects assigned to it are given a sane string representation.
@@ -12784,14 +12796,14 @@
/**
@property VERSION
@type String
- @default '1.9.0-beta.4'
+ @default '1.9.0'
@static
*/
- Ember.VERSION = '1.9.0-beta.4';
+ Ember.VERSION = '1.9.0';
/**
Standard environmental variables. You can define these in a global `EmberENV`
variable before loading Ember to control various configuration settings.
@@ -17496,39 +17508,45 @@
run.join = function() {
return backburner.join.apply(backburner, arguments);
};
/**
- Provides a useful utility for when integrating with non-Ember libraries
- that provide asynchronous callbacks.
+ Allows you to specify which context to call the specified function in while
+ adding the execution of that function to the Ember run loop. This ability
+ makes this method a great way to asynchronusly integrate third-party libraries
+ into your Ember application.
- Ember utilizes a run-loop to batch and coalesce changes. This works by
- marking the start and end of Ember-related Javascript execution.
+ `run.bind` takes two main arguments, the desired context and the function to
+ invoke in that context. Any additional arguments will be supplied as arguments
+ to the function that is passed in.
- When using events such as a View's click handler, Ember wraps the event
- handler in a run-loop, but when integrating with non-Ember libraries this
- can be tedious.
+ Let's use the creation of a TinyMCE component as an example. Currently,
+ TinyMCE provides a setup configuration option we can use to do some processing
+ after the TinyMCE instance is initialized but before it is actually rendered.
+ We can use that setup option to do some additional setup for our component.
+ The component itself could look something like the following:
- For example, the following is rather verbose but is the correct way to combine
- third-party events and Ember code.
-
```javascript
- var that = this;
- jQuery(window).on('resize', function(){
- run(function(){
- that.handleResize();
- });
+ App.RichTextEditorComponent = Ember.Component.extend({
+ initializeTinyMCE: function(){
+ tinymce.init({
+ selector: '#' + this.$().prop('id'),
+ setup: Ember.run.bind(this, this.setupEditor)
+ });
+ }.on('didInsertElement'),
+
+ setupEditor: function(editor) {
+ this.set('editor', editor);
+ editor.on('change', function(){ console.log('content changed!')} );
+ }
});
```
- To reduce the boilerplate, the following can be used to construct a
- run-loop-wrapped callback handler.
+ In this example, we use Ember.run.bind to bind the setupEditor message to the
+ context of the App.RichTextEditorComponent and to have the invocation of that
+ method be safely handled and excuted by the Ember run loop.
- ```javascript
- jQuery(window).on('resize', run.bind(this, this.handleResize));
- ```
-
@method bind
@namespace Ember
@param {Object} [target] target of method to call
@param {Function|String} method Method to invoke.
May be a function or a string. If you pass a string
@@ -17536,11 +17554,11 @@
@param {Object} [args*] Any additional arguments you wish to pass to the method.
@return {Object} return value from invoking the passed function. Please note,
when called within an existing loop, no return value is possible.
@since 1.4.0
*/
- run.bind = function(target, method /* args*/) {
+ run.bind = function(target, method /* args */) {
var args = slice.call(arguments);
return function() {
return run.join.apply(run, args.concat(slice.call(arguments)));
};
};
@@ -23017,10 +23035,12 @@
var Evented = __dependency16__["default"];
var ActionHandler = __dependency17__["default"];
var generateController = __dependency18__["default"];
var stashParamNames = __dependency19__.stashParamNames;
+ var slice = Array.prototype.slice;
+
/**
@module ember
@submodule ember-routing
*/
@@ -23979,11 +23999,20 @@
@method send
@param {String} name the name of the action to trigger
@param {...*} args
*/
send: function() {
- return this.router.send.apply(this.router, arguments);
+ if (this.router || !Ember.testing) {
+ this.router.send.apply(this.router, arguments);
+ } else {
+ var name = arguments[0];
+ var args = slice.call(arguments, 1);
+ var action = this._actions[name];
+ if (action) {
+ return this._actions[name].apply(this, args);
+ }
+ }
},
/**
This hook is the entry point for router.js
@@ -25125,10 +25154,11 @@
var router = this.router;
var location = get(this, 'location');
var container = this.container;
var self = this;
var initialURL = get(this, 'initialURL');
+ var initialTransition;
// Allow the Location class to cancel the router setup while it refreshes
// the page
if (get(location, 'cancelRouterSetup')) {
return;
@@ -25144,12 +25174,14 @@
});
if (typeof initialURL === "undefined") {
initialURL = location.getURL();
}
-
- this.handleURL(initialURL);
+ initialTransition = this.handleURL(initialURL);
+ if (initialTransition && initialTransition.error) {
+ throw initialTransition.error;
+ }
},
/**
Handles updating the paths and notifying any listeners of the URL
change.
@@ -45146,9 +45178,10 @@
this.resolvedModels = {};
this.queryParams = {};
if (error) {
this.promise = Promise.reject(error);
+ this.error = error;
return;
}
if (state) {
this.params = state.params;
\ No newline at end of file