OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
_backup
/
tinymce
/
tinymce
/
src
/
core
/
main
/
ts
/
api
/
util
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/20/2020 06:12:10 AM
rwxr-xr-x
📄
Class.ts
4.15 KB
02/20/2020 06:12:13 AM
rw-r--r--
📄
Color.ts
5.3 KB
02/20/2020 06:12:14 AM
rw-r--r--
📄
Delay.ts
6.14 KB
02/20/2020 06:12:14 AM
rw-r--r--
📄
EventDispatcher.ts
10.97 KB
02/20/2020 06:12:15 AM
rw-r--r--
📄
FakeStorage.ts
986 bytes
02/20/2020 06:12:15 AM
rw-r--r--
📄
I18n.ts
4.92 KB
02/20/2020 06:12:16 AM
rw-r--r--
📄
JSON.ts
1.63 KB
02/20/2020 06:12:16 AM
rw-r--r--
📄
JSONP.ts
1 KB
02/20/2020 06:12:17 AM
rw-r--r--
📄
JSONRequest.ts
3.36 KB
02/20/2020 06:12:17 AM
rw-r--r--
📄
LocalStorage.ts
866 bytes
02/20/2020 06:12:18 AM
rw-r--r--
📄
Observable.ts
4.92 KB
02/20/2020 06:12:18 AM
rw-r--r--
📄
Promise.ts
5.46 KB
02/20/2020 06:12:19 AM
rw-r--r--
📄
Tools.ts
12.15 KB
02/20/2020 06:12:19 AM
rw-r--r--
📄
URI.ts
12.03 KB
02/20/2020 06:12:20 AM
rw-r--r--
📄
VK.ts
1.22 KB
02/20/2020 06:12:20 AM
rw-r--r--
📄
XHR.ts
3.78 KB
02/20/2020 06:12:21 AM
rw-r--r--
Editing: Class.ts
Close
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ */ import Tools from './Tools'; /** * This utility class is used for easier inheritance. * * Features: * * Exposed super functions: this._super(); * * Mixins * * Dummy functions * * Property functions: var value = object.value(); and object.value(newValue); * * Static functions * * Defaults settings */ const each = Tools.each, extend = Tools.extend; let extendClass, initializing; interface Prop { Mixins?: any; Methods?: any; Properties?: any; Statics?: any; Defaults?: any; } interface Class { prototype: Class; extend (prop: Prop): ExtendedClass; } export interface ExtendedClass extends Class { constructor: ExtendedClass; init? (...args: any[]): void; // TODO See if we can type this to allow adding the props dynamically [key: string]: any; } const Class: Class = function () { }; // Provides classical inheritance, based on code made by John Resig Class.extend = extendClass = function (prop: Prop): ExtendedClass { const self = this; const _super = self.prototype; let prototype, name, member; // The dummy class constructor const Class = function () { let i, mixins, mixin; const self = this; // All construction is actually done in the init method if (!initializing) { // Run class constructor if (self.init) { self.init.apply(self, arguments); } // Run mixin constructors mixins = self.Mixins; if (mixins) { i = mixins.length; while (i--) { mixin = mixins[i]; if (mixin.init) { mixin.init.apply(self, arguments); } } } } }; // Dummy function, needs to be extended in order to provide functionality const dummy = function () { return this; }; // Creates a overloaded method for the class // this enables you to use this._super(); to call the super function const createMethod = function (name, fn) { return function () { const self = this; const tmp = self._super; let ret; self._super = _super[name]; ret = fn.apply(self, arguments); self._super = tmp; return ret; }; }; // Instantiate a base class (but only create the instance, // don't run the init constructor) initializing = true; /*eslint new-cap:0 */ prototype = new self(); initializing = false; // Add mixins if (prop.Mixins) { each(prop.Mixins, function (mixin) { for (const name in mixin) { if (name !== 'init') { prop[name] = mixin[name]; } } }); if (_super.Mixins) { prop.Mixins = _super.Mixins.concat(prop.Mixins); } } // Generate dummy methods if (prop.Methods) { each(prop.Methods.split(','), function (name) { prop[name] = dummy; }); } // Generate property methods if (prop.Properties) { each(prop.Properties.split(','), function (name) { const fieldName = '_' + name; prop[name] = function (value) { const self = this; // Set value if (value !== undefined) { self[fieldName] = value; return self; } // Get value return self[fieldName]; }; }); } // Static functions if (prop.Statics) { each(prop.Statics, function (func, name) { Class[name] = func; }); } // Default settings if (prop.Defaults && _super.Defaults) { prop.Defaults = extend({}, _super.Defaults, prop.Defaults); } // Copy the properties over onto the new prototype for (name in prop) { member = prop[name]; if (typeof member === 'function' && _super[name]) { prototype[name] = createMethod(name, member); } else { prototype[name] = member; } } // Populate our constructed prototype object Class.prototype = prototype; // Enforce the constructor to be what we expect Class.constructor = Class; // And make this class extendable Class.extend = extendClass; return Class; }; export default Class;