PageSourceSearch

https://etlady.tw/js/Proxy.js

js etlady.tw collected 2026-10-07 01:35:49 UTC 2,798 bytes, 78 lines download raw bytes

1/*
2* Proxy
3* Visit http://createjs.com/ for documentation, updates and examples.
4*
5* Copyright (c) 2010 gskinner.com, inc.
6* 
7* Permission is hereby granted, free of charge, to any person
8* obtaining a copy of this software and associated documentation
9* files (the "Software"), to deal in the Software without
10* restriction, including without limitation the rights to use,
11* copy, modify, merge, publish, distribute, sublicense, and/or sell
12* copies of the Software, and to permit persons to whom the
13* Software is furnished to do so, subject to the following
14* conditions:
15* 
16* The above copyright notice and this permission notice shall be
17* included in all copies or substantial portions of the Software.
18* 
19* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26* OTHER DEALINGS IN THE SOFTWARE.
27*/
28
29/**
30 * @module CreateJS
31 */
32
33// namespace:
34this.createjs = this.createjs||{};
35
36/**
37 * Various utilities that the CreateJS Suite uses. Utilities are created as separate files, and will be available on the
38 * createjs namespace directly:
39 *
40 * <h4>Example</h4>
41 *      myObject.addEventListener("change", createjs.proxy(myMethod, scope));
42 *
43 * @class Utility Methods
44 * @main Utility Methods
45 */
46
47(function() {
48	"use strict";
49
50	/**
51	 * A function proxy for methods. By default, JavaScript methods do not maintain scope, so passing a method as a
52	 * callback will result in the method getting called in the scope of the caller. Using a proxy ensures that the
53	 * method gets called in the correct scope.
54	 *
55	 * Additional arguments can be passed that will be applied to the function when it is called.
56	 *
57	 * <h4>Example</h4>
58	 *      myObject.addEventListener("event", createjs.proxy(myHandler, this, arg1, arg2));
59	 *
60	 *      function myHandler(arg1, arg2) {
61	 *           // This gets called when myObject.myCallback is executed.
62	 *      }
63	 *
64	 * @method proxy
65	 * @param {Function} method The function to call
66	 * @param {Object} scope The scope to call the method name on
67	 * @param {mixed} [arg] * Arguments that are appended to the callback for additional params.
68	 * @public
69	 * @static
70	 */
71	createjs.proxy = function (method, scope) {
72		var aArgs = Array.prototype.slice.call(arguments, 2);
73		return function () {
74			return method.apply(scope, Array.prototype.slice.call(arguments, 0).concat(aArgs));
75		};
76	}
77
78}());

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.