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: Observable.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 EventDispatcher, { EditorEvent, NativeEventMap } from './EventDispatcher'; interface Observable<T extends NativeEventMap> { fire <K extends keyof T>(name: K, args?: T[K], bubble?: boolean): EditorEvent<T[K]>; fire <U = any>(name: string, args?: U, bubble?: boolean): EditorEvent<U>; on <K extends keyof T>(name: K, callback: (event: EditorEvent<T[K]>) => void, prepend?: boolean): EventDispatcher<T>; on <U = any>(name: string, callback: (event: EditorEvent<U>) => void, prepend?: boolean): EventDispatcher<T>; off <K extends keyof T>(name?: K, callback?: (event: EditorEvent<T[K]>) => void): EventDispatcher<T>; off <U = any>(name?: string, callback?: (event: EditorEvent<U>) => void): EventDispatcher<T>; once <K extends keyof T>(name: K, callback: (event: EditorEvent<T[K]>) => void): EventDispatcher<T>; once <U = any>(name: string, callback: (event: EditorEvent<U>) => void): EventDispatcher<T>; hasEventListeners (name: string): boolean; } /** * This mixin will add event binding logic to classes. * * @mixin tinymce.util.Observable */ const getEventDispatcher = function (obj): EventDispatcher<any> { if (!obj._eventDispatcher) { obj._eventDispatcher = new EventDispatcher({ scope: obj, toggleEvent (name, state) { if (EventDispatcher.isNative(name) && obj.toggleNativeEvent) { obj.toggleNativeEvent(name, state); } } }); } return obj._eventDispatcher; }; const Observable: Observable<any> = { /** * Fires the specified event by name. Consult the * <a href="/docs/advanced/events">event reference</a> for more details on each event. * * @method fire * @param {String} name Name of the event to fire. * @param {Object?} args Event arguments. * @param {Boolean?} bubble True/false if the event is to be bubbled. * @return {Object} Event args instance passed in. * @example * instance.fire('event', {...}); */ fire (name, args?, bubble?) { const self = this; // Prevent all events except the remove/detach event after the instance has been removed if (self.removed && name !== 'remove' && name !== 'detach') { // TODO should we be patching the EventArgs here like EventDispatcher? return args as any; } const dispatcherArgs = getEventDispatcher(self).fire(name, args); // Bubble event up to parents if (bubble !== false && self.parent) { let parent = self.parent(); while (parent && !dispatcherArgs.isPropagationStopped()) { parent.fire(name, dispatcherArgs, false); parent = parent.parent(); } } return dispatcherArgs; }, /** * Binds an event listener to a specific event by name. Consult the * <a href="/docs/advanced/events">event reference</a> for more details on each event. * * @method on * @param {String} name Event name or space separated list of events to bind. * @param {callback} callback Callback to be executed when the event occurs. * @param {Boolean} prepend Optional flag if the event should be prepended. Use this with care. * @return {Object} Current class instance. * @example * instance.on('event', function(e) { * // Callback logic * }); */ on (name, callback, prepend?) { return getEventDispatcher(this).on(name, callback, prepend); }, /** * Unbinds an event listener to a specific event by name. Consult the * <a href="/docs/advanced/events">event reference</a> for more details on each event. * * @method off * @param {String?} name Name of the event to unbind. * @param {callback?} callback Callback to unbind. * @return {Object} Current class instance. * @example * // Unbind specific callback * instance.off('event', handler); * * // Unbind all listeners by name * instance.off('event'); * * // Unbind all events * instance.off(); */ off (name?, callback?) { return getEventDispatcher(this).off(name, callback); }, /** * Bind the event callback and once it fires the callback is removed. Consult the * <a href="/docs/advanced/events">event reference</a> for more details on each event. * * @method once * @param {String} name Name of the event to bind. * @param {callback} callback Callback to bind only once. * @return {Object} Current class instance. */ once (name, callback) { return getEventDispatcher(this).once(name, callback); }, /** * Returns true/false if the object has a event of the specified name. * * @method hasEventListeners * @param {String} name Name of the event to check for. * @return {Boolean} true/false if the event exists or not. */ hasEventListeners (name) { return getEventDispatcher(this).has(name); } }; export default Observable;