Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1958)

Unified Diff: appengine_apps/chromium_status/static/js/common/bind.js

Issue 778533003: Moved chromium_status to appengine/ (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: appengine_apps/chromium_status/static/js/common/bind.js
diff --git a/appengine_apps/chromium_status/static/js/common/bind.js b/appengine_apps/chromium_status/static/js/common/bind.js
deleted file mode 100644
index b43df303642ff20fdb647db334ae6262898067ac..0000000000000000000000000000000000000000
--- a/appengine_apps/chromium_status/static/js/common/bind.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// The following code is taken from:
-// http://code.google.com/p/browsersync/source/browse/trunk/client/lib/base/lang.js
-
-/**
- * Partially applies this function to a particular "this object" and zero or
- * more arguments. The result is a new function with some arguments of the first
- * function pre-filled and the value of |this| "pre-specified".
- *
- * Remaining arguments specified at call-time are appended to the pre-
- * specified ones.
- *
- * Also see: partial().
- *
- * Note that bind and partial are optimized such that repeated calls to it do
- * not create more than one function object, so there is no additional cost for
- * something like:
- *
- * var g = bind(f, obj);
- * var h = partial(g, 1, 2, 3);
- * var k = partial(h, a, b, c);
- *
- * Usage:
- * var barMethBound = bind(myFunction, myObj, "arg1", "arg2");
- * barMethBound("arg3", "arg4");
- *
- * @param self {Object} Specifies the object which |this| should point to
- * when the function is run. If the value is null or undefined, it will default
- * to the global object.
- *
- * @returns {Function} A partially-applied form of the function bind() was
- * invoked as a method of.
- */
-function bind(fn, self, var_args) {
- var boundargs = fn.boundArgs_ || [];
- boundargs = boundargs.concat(Array.prototype.slice.call(arguments, 2));
-
- if (typeof fn.boundSelf_ != "undefined") {
- self = fn.boundSelf_;
- }
-
- if (typeof fn.boundFn_ != "undefined") {
- fn = fn.boundFn_;
- }
-
- var newfn = function() {
- // Combine the static args and the new args into one big array
- var args = boundargs.concat(Array.prototype.slice.call(arguments));
- return fn.apply(self, args);
- }
-
- newfn.boundArgs_ = boundargs;
- newfn.boundSelf_ = self;
- newfn.boundFn_ = fn;
-
- return newfn;
-}
-
-/**
- * An alias to the bind() global function.
- *
- * Usage:
- * var g = f.bind(obj, arg1, arg2);
- * g(arg3, arg4);
- */
-Function.prototype.bind = function(self, var_args) {
- return bind.apply(
- null, [this, self].concat(Array.prototype.slice.call(arguments, 1)));
-}

Powered by Google App Engine
This is Rietveld 408576698