From fdf1f0a6a4a227dd9d106c99e703efb292df6941 Mon Sep 17 00:00:00 2001 From: IgorT Date: Wed, 17 Dec 2014 21:16:56 -0500 Subject: [PATCH] Shim backburner join until we are sure Ember has it --- packages/ember-data/lib/system/store.js | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/packages/ember-data/lib/system/store.js b/packages/ember-data/lib/system/store.js index b2b36d736ec..c5f8c2eb00f 100644 --- a/packages/ember-data/lib/system/store.js +++ b/packages/ember-data/lib/system/store.js @@ -25,6 +25,46 @@ import { Model } from "ember-data/system/model"; //Stanley told me to do this var Backburner = Ember.__loader.require('backburner')['default'] || Ember.__loader.require('backburner')['Backburner']; +//Shim Backburner.join +if (!Backburner.prototype.join) { + var isString = function(suspect) { + return typeof suspect === 'string'; + }; + + Backburner.prototype.join = function(/*target, method, args */) { + var method, target; + + if (this.currentInstance) { + var length = arguments.length; + if (length === 1) { + method = arguments[0]; + target = null; + } else { + target = arguments[0]; + method = arguments[1]; + } + + if (isString(method)) { + method = target[method]; + } + + if (length === 1) { + return method(); + } else if (length === 2) { + return method.call(target); + } else { + var args = new Array(length - 2); + for (var i =0, l = length - 2; i < l; i++) { + args[i] = arguments[i + 2]; + } + return method.apply(target, args); + } + } else { + return this.run.apply(this, arguments); + } + }; +} + var get = Ember.get; var set = Ember.set;