@next2d/events 1.18.12 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -24
- package/src/Event.d.ts +222 -0
- package/src/Event.js +337 -0
- package/src/EventDispatcher/service/EventDispatcherAddEventListenerService.d.ts +14 -0
- package/src/EventDispatcher/service/EventDispatcherAddEventListenerService.js +87 -0
- package/src/EventDispatcher/service/EventDispatcherDispatchEventService.d.ts +13 -0
- package/src/EventDispatcher/service/EventDispatcherDispatchEventService.js +189 -0
- package/src/EventDispatcher/service/EventDispatcherHasEventListenerService.d.ts +12 -0
- package/src/EventDispatcher/service/EventDispatcherHasEventListenerService.js +25 -0
- package/src/EventDispatcher/service/EventDispatcherRemoveAllEventListenerService.d.ts +13 -0
- package/src/EventDispatcher/service/EventDispatcherRemoveAllEventListenerService.js +83 -0
- package/src/EventDispatcher/service/EventDispatcherRemoveEventListenerService.d.ts +14 -0
- package/src/EventDispatcher/service/EventDispatcherRemoveEventListenerService.js +80 -0
- package/src/EventDispatcher/service/EventDispatcherWillTriggerService.d.ts +12 -0
- package/src/EventDispatcher/service/EventDispatcherWillTriggerService.js +28 -0
- package/{dist → src}/EventDispatcher.d.ts +13 -62
- package/src/EventDispatcher.js +120 -0
- package/src/EventPhase.d.ts +39 -0
- package/src/EventPhase.js +45 -0
- package/src/EventUtil.d.ts +42 -0
- package/src/EventUtil.js +59 -0
- package/src/FocusEvent.d.ts +42 -0
- package/src/FocusEvent.js +71 -0
- package/src/HTTPStatusEvent.d.ts +63 -0
- package/src/HTTPStatusEvent.js +99 -0
- package/src/IOErrorEvent.d.ts +39 -0
- package/src/IOErrorEvent.js +49 -0
- package/src/JobEvent.d.ts +29 -0
- package/src/JobEvent.js +33 -0
- package/src/KeyboardEvent.d.ts +37 -0
- package/src/KeyboardEvent.js +66 -0
- package/src/PointerEvent.d.ts +84 -0
- package/src/PointerEvent.js +127 -0
- package/src/ProgressEvent.d.ts +53 -0
- package/src/ProgressEvent.js +69 -0
- package/src/VideoEvent.d.ts +47 -0
- package/src/VideoEvent.js +55 -0
- package/src/WheelEvent.d.ts +28 -0
- package/src/WheelEvent.js +49 -0
- package/{dist → src}/index.d.ts +5 -1
- package/{dist → src}/index.js +5 -1
- package/src/interface/IEvent.d.ts +2 -0
- package/src/interface/IEvent.js +1 -0
- package/src/interface/IEventDispatcher.d.ts +2 -0
- package/src/interface/IEventDispatcher.js +1 -0
- package/src/interface/IEventListener.d.ts +7 -0
- package/src/interface/IEventListener.js +1 -0
- package/src/interface/IURLRequestHeader.d.ts +4 -0
- package/src/interface/IURLRequestHeader.js +1 -0
- package/dist/Event.d.ts +0 -424
- package/dist/Event.js +0 -560
- package/dist/EventDispatcher.js +0 -622
- package/dist/EventPhase.d.ts +0 -80
- package/dist/EventPhase.js +0 -94
- package/dist/FocusEvent.d.ts +0 -89
- package/dist/FocusEvent.js +0 -103
- package/dist/HTTPStatusEvent.d.ts +0 -107
- package/dist/HTTPStatusEvent.js +0 -139
- package/dist/IOErrorEvent.d.ts +0 -82
- package/dist/IOErrorEvent.js +0 -101
- package/dist/MouseEvent.d.ts +0 -163
- package/dist/MouseEvent.js +0 -207
- package/dist/ProgressEvent.d.ts +0 -97
- package/dist/ProgressEvent.js +0 -123
- package/dist/VideoEvent.d.ts +0 -145
- package/dist/VideoEvent.js +0 -181
|
@@ -1,68 +1,19 @@
|
|
|
1
|
-
import { Event } from "./Event";
|
|
2
|
-
import type {
|
|
1
|
+
import type { Event } from "./Event";
|
|
2
|
+
import type { IEventListener } from "./interface/IEventListener";
|
|
3
3
|
/**
|
|
4
|
-
* EventDispatcher クラスは、イベントを送出するすべてのクラスの基本クラスです。
|
|
5
|
-
*
|
|
6
|
-
* The EventDispatcher class is the base class for all classes that dispatch events.
|
|
7
|
-
*
|
|
8
|
-
* @example <caption>Example usage of EventDispatcher.</caption>
|
|
9
|
-
* // new ColorTransform
|
|
10
|
-
* const {EventDispatcher} = next2d.events;
|
|
11
|
-
* const eventDispatcher = new EventDispatcher();
|
|
12
|
-
* eventDispatcher.addEventListener(Event.ENTER_FRAME, function (event)
|
|
13
|
-
* {
|
|
14
|
-
* // more...
|
|
15
|
-
* });
|
|
4
|
+
* @description EventDispatcher クラスは、イベントを送出するすべてのクラスの基本クラスです。
|
|
5
|
+
* The EventDispatcher class is the base class for all classes that dispatch events.
|
|
16
6
|
*
|
|
17
7
|
* @class
|
|
18
8
|
* @memberOf next2d.events
|
|
19
9
|
*/
|
|
20
10
|
export declare class EventDispatcher {
|
|
21
|
-
_$events: Map<string,
|
|
11
|
+
_$events: Map<string, IEventListener[]> | null;
|
|
22
12
|
/**
|
|
23
13
|
* @constructor
|
|
24
14
|
* @public
|
|
25
15
|
*/
|
|
26
16
|
constructor();
|
|
27
|
-
/**
|
|
28
|
-
* 指定されたクラスのストリングを返します。
|
|
29
|
-
* Returns the string representation of the specified class.
|
|
30
|
-
*
|
|
31
|
-
* @return {string}
|
|
32
|
-
* @default [class EventDispatcher]
|
|
33
|
-
* @method
|
|
34
|
-
* @static
|
|
35
|
-
*/
|
|
36
|
-
static toString(): string;
|
|
37
|
-
/**
|
|
38
|
-
* @description 指定されたクラスの空間名を返します。
|
|
39
|
-
* Returns the space name of the specified class.
|
|
40
|
-
*
|
|
41
|
-
* @member {string}
|
|
42
|
-
* @default next2d.events.EventDispatcher
|
|
43
|
-
* @const
|
|
44
|
-
* @static
|
|
45
|
-
*/
|
|
46
|
-
static get namespace(): string;
|
|
47
|
-
/**
|
|
48
|
-
* @description 指定されたオブジェクトのストリングを返します。
|
|
49
|
-
* Returns the string representation of the specified object.
|
|
50
|
-
*
|
|
51
|
-
* @return {string}
|
|
52
|
-
* @method
|
|
53
|
-
* @public
|
|
54
|
-
*/
|
|
55
|
-
toString(): string;
|
|
56
|
-
/**
|
|
57
|
-
* @description 指定されたオブジェクトの空間名を返します。
|
|
58
|
-
* Returns the space name of the specified object.
|
|
59
|
-
*
|
|
60
|
-
* @member {string}
|
|
61
|
-
* @default next2d.events.EventDispatcher
|
|
62
|
-
* @const
|
|
63
|
-
* @public
|
|
64
|
-
*/
|
|
65
|
-
get namespace(): string;
|
|
66
17
|
/**
|
|
67
18
|
* @description イベントリスナーオブジェクトを EventDispatcher オブジェクトに登録し、
|
|
68
19
|
* リスナーがイベントの通知を受け取るようにします。
|
|
@@ -71,8 +22,8 @@ export declare class EventDispatcher {
|
|
|
71
22
|
*
|
|
72
23
|
* @param {string} type
|
|
73
24
|
* @param {function} listener
|
|
74
|
-
* @param {boolean} [use_capture=false]
|
|
75
|
-
* @param {number} [priority=0]
|
|
25
|
+
* @param {boolean} [use_capture = false]
|
|
26
|
+
* @param {number} [priority = 0]
|
|
76
27
|
* @return {void}
|
|
77
28
|
* @method
|
|
78
29
|
* @public
|
|
@@ -87,7 +38,7 @@ export declare class EventDispatcher {
|
|
|
87
38
|
* @method
|
|
88
39
|
* @public
|
|
89
40
|
*/
|
|
90
|
-
dispatchEvent(event:
|
|
41
|
+
dispatchEvent<E extends Event>(event: E): boolean;
|
|
91
42
|
/**
|
|
92
43
|
* @description EventDispatcher オブジェクトに、特定のイベントタイプに対して登録されたリスナーがあるかどうかを確認します。
|
|
93
44
|
* Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
|
|
@@ -103,19 +54,19 @@ export declare class EventDispatcher {
|
|
|
103
54
|
* Removes a listener from the EventDispatcher object.
|
|
104
55
|
*
|
|
105
56
|
* @param {string} type
|
|
106
|
-
* @param {function}
|
|
57
|
+
* @param {function} listener
|
|
107
58
|
* @param {boolean} [use_capture = false]
|
|
108
59
|
* @return {void}
|
|
109
60
|
* @method
|
|
110
61
|
* @public
|
|
111
62
|
*/
|
|
112
|
-
removeEventListener(type: string, listener: Function
|
|
63
|
+
removeEventListener(type: string, listener: Function, use_capture?: boolean): void;
|
|
113
64
|
/**
|
|
114
65
|
* @description EventDispatcherオブジェクトから指定したタイプのリスナーを全て削除します。
|
|
115
66
|
* Removes all listeners of the specified type from the EventDispatcher object.
|
|
116
67
|
*
|
|
117
|
-
* @param {string}
|
|
118
|
-
* @param {boolean}
|
|
68
|
+
* @param {string} type
|
|
69
|
+
* @param {boolean} [use_capture=false]
|
|
119
70
|
* @return {void}
|
|
120
71
|
* @method
|
|
121
72
|
* @public
|
|
@@ -129,7 +80,7 @@ export declare class EventDispatcher {
|
|
|
129
80
|
* with this EventDispatcher object or
|
|
130
81
|
* any of its ancestors for the specified event type.
|
|
131
82
|
*
|
|
132
|
-
* @param {string}
|
|
83
|
+
* @param {string} type
|
|
133
84
|
* @return {boolean}
|
|
134
85
|
* @method
|
|
135
86
|
* @public
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { execute as eventDispatcherAddEventListenerService } from "./EventDispatcher/service/EventDispatcherAddEventListenerService";
|
|
2
|
+
import { execute as eventDispatcherHasEventListenerService } from "./EventDispatcher/service/EventDispatcherHasEventListenerService";
|
|
3
|
+
import { execute as eventDispatcherRemoveEventListenerService } from "./EventDispatcher/service/EventDispatcherRemoveEventListenerService";
|
|
4
|
+
import { execute as eventDispatcherRemoveAllEventListenerService } from "./EventDispatcher/service/EventDispatcherRemoveAllEventListenerService";
|
|
5
|
+
import { execute as eventDispatcherWillTriggerService } from "./EventDispatcher/service/EventDispatcherWillTriggerService";
|
|
6
|
+
import { execute as eventDispatcherDispatchEventService } from "./EventDispatcher/service/EventDispatcherDispatchEventService";
|
|
7
|
+
/**
|
|
8
|
+
* @description EventDispatcher クラスは、イベントを送出するすべてのクラスの基本クラスです。
|
|
9
|
+
* The EventDispatcher class is the base class for all classes that dispatch events.
|
|
10
|
+
*
|
|
11
|
+
* @class
|
|
12
|
+
* @memberOf next2d.events
|
|
13
|
+
*/
|
|
14
|
+
export class EventDispatcher {
|
|
15
|
+
/**
|
|
16
|
+
* @constructor
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
constructor() {
|
|
20
|
+
Object.defineProperty(this, "_$events", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* @type {Map}
|
|
28
|
+
* @default null
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
31
|
+
this._$events = null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @description イベントリスナーオブジェクトを EventDispatcher オブジェクトに登録し、
|
|
35
|
+
* リスナーがイベントの通知を受け取るようにします。
|
|
36
|
+
* Registers an event listener object with an EventDispatcher object
|
|
37
|
+
* so that the listener receives notification of an event.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} type
|
|
40
|
+
* @param {function} listener
|
|
41
|
+
* @param {boolean} [use_capture = false]
|
|
42
|
+
* @param {number} [priority = 0]
|
|
43
|
+
* @return {void}
|
|
44
|
+
* @method
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
addEventListener(type, listener, use_capture = false, priority = 0) {
|
|
48
|
+
if (!this._$events) {
|
|
49
|
+
this._$events = new Map();
|
|
50
|
+
}
|
|
51
|
+
eventDispatcherAddEventListenerService(this, type, listener, use_capture, priority);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @description イベントをイベントフローに送出します。
|
|
55
|
+
* Dispatches an event into the event flow.
|
|
56
|
+
*
|
|
57
|
+
* @param {Event} event
|
|
58
|
+
* @return {boolean}
|
|
59
|
+
* @method
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
dispatchEvent(event) {
|
|
63
|
+
return eventDispatcherDispatchEventService(this, event);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @description EventDispatcher オブジェクトに、特定のイベントタイプに対して登録されたリスナーがあるかどうかを確認します。
|
|
67
|
+
* Checks whether the EventDispatcher object has any listeners registered for a specific type of event.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} type
|
|
70
|
+
* @return {boolean}
|
|
71
|
+
* @method
|
|
72
|
+
* @public
|
|
73
|
+
*/
|
|
74
|
+
hasEventListener(type) {
|
|
75
|
+
return eventDispatcherHasEventListenerService(this, type);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description EventDispatcher オブジェクトからリスナーを削除します。
|
|
79
|
+
* Removes a listener from the EventDispatcher object.
|
|
80
|
+
*
|
|
81
|
+
* @param {string} type
|
|
82
|
+
* @param {function} listener
|
|
83
|
+
* @param {boolean} [use_capture = false]
|
|
84
|
+
* @return {void}
|
|
85
|
+
* @method
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
removeEventListener(type, listener, use_capture = false) {
|
|
89
|
+
eventDispatcherRemoveEventListenerService(this, type, listener, use_capture);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @description EventDispatcherオブジェクトから指定したタイプのリスナーを全て削除します。
|
|
93
|
+
* Removes all listeners of the specified type from the EventDispatcher object.
|
|
94
|
+
*
|
|
95
|
+
* @param {string} type
|
|
96
|
+
* @param {boolean} [use_capture=false]
|
|
97
|
+
* @return {void}
|
|
98
|
+
* @method
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
removeAllEventListener(type, use_capture = false) {
|
|
102
|
+
eventDispatcherRemoveAllEventListenerService(this, type, use_capture);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @description 指定されたイベントタイプについて、
|
|
106
|
+
* この EventDispatcher オブジェクトまたはその祖先にイベントリスナーが
|
|
107
|
+
* 登録されているかどうかを確認します。
|
|
108
|
+
* Checks whether an event listener is registered
|
|
109
|
+
* with this EventDispatcher object or
|
|
110
|
+
* any of its ancestors for the specified event type.
|
|
111
|
+
*
|
|
112
|
+
* @param {string} type
|
|
113
|
+
* @return {boolean}
|
|
114
|
+
* @method
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
willTrigger(type) {
|
|
118
|
+
return eventDispatcherWillTriggerService(this, type);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description EventPhase クラスは、Event クラスの eventPhase プロパティの値を提供します。
|
|
3
|
+
* The EventPhase class provides values for the eventPhase property of the Event class.
|
|
4
|
+
*
|
|
5
|
+
* @class
|
|
6
|
+
* @memberOf next2d.events
|
|
7
|
+
*/
|
|
8
|
+
export declare class EventPhase {
|
|
9
|
+
/**
|
|
10
|
+
* @description ターゲット段階(イベントフローの 2 番目の段階)です。
|
|
11
|
+
* The target phase, which is the second phase of the event flow.
|
|
12
|
+
*
|
|
13
|
+
* @return {number}
|
|
14
|
+
* @default 2
|
|
15
|
+
* @const
|
|
16
|
+
* @static
|
|
17
|
+
*/
|
|
18
|
+
static get AT_TARGET(): number;
|
|
19
|
+
/**
|
|
20
|
+
* @description ターゲット段階(イベントフローの 2 番目の段階)です。
|
|
21
|
+
* The target phase, which is the second phase of the event flow.
|
|
22
|
+
*
|
|
23
|
+
* @return {number}
|
|
24
|
+
* @default 3
|
|
25
|
+
* @const
|
|
26
|
+
* @static
|
|
27
|
+
*/
|
|
28
|
+
static get BUBBLING_PHASE(): number;
|
|
29
|
+
/**
|
|
30
|
+
* @description キャプチャ段階(イベントフローの最初の段階)です。
|
|
31
|
+
* The capturing phase, which is the first phase of the event flow.
|
|
32
|
+
*
|
|
33
|
+
* @return {number}
|
|
34
|
+
* @default 1
|
|
35
|
+
* @const
|
|
36
|
+
* @static
|
|
37
|
+
*/
|
|
38
|
+
static get CAPTURING_PHASE(): number;
|
|
39
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description EventPhase クラスは、Event クラスの eventPhase プロパティの値を提供します。
|
|
3
|
+
* The EventPhase class provides values for the eventPhase property of the Event class.
|
|
4
|
+
*
|
|
5
|
+
* @class
|
|
6
|
+
* @memberOf next2d.events
|
|
7
|
+
*/
|
|
8
|
+
export class EventPhase {
|
|
9
|
+
/**
|
|
10
|
+
* @description ターゲット段階(イベントフローの 2 番目の段階)です。
|
|
11
|
+
* The target phase, which is the second phase of the event flow.
|
|
12
|
+
*
|
|
13
|
+
* @return {number}
|
|
14
|
+
* @default 2
|
|
15
|
+
* @const
|
|
16
|
+
* @static
|
|
17
|
+
*/
|
|
18
|
+
static get AT_TARGET() {
|
|
19
|
+
return 2;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @description ターゲット段階(イベントフローの 2 番目の段階)です。
|
|
23
|
+
* The target phase, which is the second phase of the event flow.
|
|
24
|
+
*
|
|
25
|
+
* @return {number}
|
|
26
|
+
* @default 3
|
|
27
|
+
* @const
|
|
28
|
+
* @static
|
|
29
|
+
*/
|
|
30
|
+
static get BUBBLING_PHASE() {
|
|
31
|
+
return 3;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @description キャプチャ段階(イベントフローの最初の段階)です。
|
|
35
|
+
* The capturing phase, which is the first phase of the event flow.
|
|
36
|
+
*
|
|
37
|
+
* @return {number}
|
|
38
|
+
* @default 1
|
|
39
|
+
* @const
|
|
40
|
+
* @static
|
|
41
|
+
*/
|
|
42
|
+
static get CAPTURING_PHASE() {
|
|
43
|
+
return 1;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { IEventListener } from "./interface/IEventListener";
|
|
2
|
+
/**
|
|
3
|
+
* @type {Map}
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export declare const $broadcastEvents: Map<string, IEventListener[]>;
|
|
7
|
+
/**
|
|
8
|
+
* @return {array}
|
|
9
|
+
* @method
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
export declare const $getArray: () => any[];
|
|
13
|
+
/**
|
|
14
|
+
* @return {void}
|
|
15
|
+
* @method
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
export declare const $poolArray: (array: any[]) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @private
|
|
21
|
+
*/
|
|
22
|
+
type IEvent = PointerEvent | KeyboardEvent | WheelEvent | Event | null;
|
|
23
|
+
/**
|
|
24
|
+
* @description アクティブなイベントオブジェクをセット
|
|
25
|
+
* Set the active event object
|
|
26
|
+
*
|
|
27
|
+
* @param {IEvent} event
|
|
28
|
+
* @return {void}
|
|
29
|
+
* @method
|
|
30
|
+
* @protected
|
|
31
|
+
*/
|
|
32
|
+
export declare const $setEvent: (event: IEvent) => void;
|
|
33
|
+
/**
|
|
34
|
+
* @description アクティブなイベントオブジェクを取得
|
|
35
|
+
* Get the active event object
|
|
36
|
+
*
|
|
37
|
+
* @return {IEvent}
|
|
38
|
+
* @method
|
|
39
|
+
* @protected
|
|
40
|
+
*/
|
|
41
|
+
export declare const $getEvent: () => IEvent;
|
|
42
|
+
export {};
|
package/src/EventUtil.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {Map}
|
|
3
|
+
* @private
|
|
4
|
+
*/
|
|
5
|
+
export const $broadcastEvents = new Map();
|
|
6
|
+
/**
|
|
7
|
+
* @type {array}
|
|
8
|
+
* @private
|
|
9
|
+
*/
|
|
10
|
+
const $array = [];
|
|
11
|
+
/**
|
|
12
|
+
* @return {array}
|
|
13
|
+
* @method
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
export const $getArray = () => {
|
|
17
|
+
return $array.length
|
|
18
|
+
? $array.pop()
|
|
19
|
+
: [];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* @return {void}
|
|
23
|
+
* @method
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
26
|
+
export const $poolArray = (array) => {
|
|
27
|
+
if (10 > $array.length) {
|
|
28
|
+
array.length = 0;
|
|
29
|
+
$array.push(array);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @type {IEvent}
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
36
|
+
let $event = null;
|
|
37
|
+
/**
|
|
38
|
+
* @description アクティブなイベントオブジェクをセット
|
|
39
|
+
* Set the active event object
|
|
40
|
+
*
|
|
41
|
+
* @param {IEvent} event
|
|
42
|
+
* @return {void}
|
|
43
|
+
* @method
|
|
44
|
+
* @protected
|
|
45
|
+
*/
|
|
46
|
+
export const $setEvent = (event) => {
|
|
47
|
+
$event = event;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* @description アクティブなイベントオブジェクを取得
|
|
51
|
+
* Get the active event object
|
|
52
|
+
*
|
|
53
|
+
* @return {IEvent}
|
|
54
|
+
* @method
|
|
55
|
+
* @protected
|
|
56
|
+
*/
|
|
57
|
+
export const $getEvent = () => {
|
|
58
|
+
return $event;
|
|
59
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Event } from "./Event";
|
|
2
|
+
/**
|
|
3
|
+
* @description FocusEvent オブジェクトは、ユーザーが表示リストの1つのオブジェクトから
|
|
4
|
+
* 別のオブジェクトにフォーカスを変更したときにオブジェクトによって送出されます。
|
|
5
|
+
* 次の2種類のフォーカスイベントがあります。
|
|
6
|
+
*
|
|
7
|
+
* An object dispatches a FocusEvent object when the user changes
|
|
8
|
+
* the focus from one object in the display list to another.
|
|
9
|
+
* There are two types of focus events:
|
|
10
|
+
*
|
|
11
|
+
* @class
|
|
12
|
+
* @memberOf next2d.events
|
|
13
|
+
* @extends Event
|
|
14
|
+
*/
|
|
15
|
+
export declare class FocusEvent extends Event {
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} type
|
|
18
|
+
* @param {boolean} [bubbles=true]
|
|
19
|
+
*
|
|
20
|
+
* @constructor
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
constructor(type: string, bubbles?: boolean);
|
|
24
|
+
/**
|
|
25
|
+
* @description focusIn イベントオブジェクトの type プロパティ値を定義します。
|
|
26
|
+
* Defines the value of the type property of a focusIn event object.
|
|
27
|
+
*
|
|
28
|
+
* @return {string}
|
|
29
|
+
* @const
|
|
30
|
+
* @static
|
|
31
|
+
*/
|
|
32
|
+
static get FOCUS_IN(): string;
|
|
33
|
+
/**
|
|
34
|
+
* @description focusOut イベントオブジェクトの type プロパティ値を定義します。
|
|
35
|
+
* Defines the value of the type property of a focusOut event object.
|
|
36
|
+
*
|
|
37
|
+
* @return {string}
|
|
38
|
+
* @const
|
|
39
|
+
* @static
|
|
40
|
+
*/
|
|
41
|
+
static get FOCUS_OUT(): string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Event } from "./Event";
|
|
2
|
+
import { $getEvent } from "./EventUtil";
|
|
3
|
+
/**
|
|
4
|
+
* @description FocusEvent オブジェクトは、ユーザーが表示リストの1つのオブジェクトから
|
|
5
|
+
* 別のオブジェクトにフォーカスを変更したときにオブジェクトによって送出されます。
|
|
6
|
+
* 次の2種類のフォーカスイベントがあります。
|
|
7
|
+
*
|
|
8
|
+
* An object dispatches a FocusEvent object when the user changes
|
|
9
|
+
* the focus from one object in the display list to another.
|
|
10
|
+
* There are two types of focus events:
|
|
11
|
+
*
|
|
12
|
+
* @class
|
|
13
|
+
* @memberOf next2d.events
|
|
14
|
+
* @extends Event
|
|
15
|
+
*/
|
|
16
|
+
export class FocusEvent extends Event {
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} type
|
|
19
|
+
* @param {boolean} [bubbles=true]
|
|
20
|
+
*
|
|
21
|
+
* @constructor
|
|
22
|
+
* @public
|
|
23
|
+
*/
|
|
24
|
+
constructor(type, bubbles = true) {
|
|
25
|
+
super(type, bubbles);
|
|
26
|
+
return new Proxy(this, {
|
|
27
|
+
"get": (object, name) => {
|
|
28
|
+
if (name in object) {
|
|
29
|
+
return object[name];
|
|
30
|
+
}
|
|
31
|
+
const event = $getEvent();
|
|
32
|
+
if (!event) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
switch (event.type) {
|
|
36
|
+
case FocusEvent.FOCUS_IN:
|
|
37
|
+
case FocusEvent.FOCUS_OUT:
|
|
38
|
+
if (name in event) {
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
return $event[name];
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
default:
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description focusIn イベントオブジェクトの type プロパティ値を定義します。
|
|
51
|
+
* Defines the value of the type property of a focusIn event object.
|
|
52
|
+
*
|
|
53
|
+
* @return {string}
|
|
54
|
+
* @const
|
|
55
|
+
* @static
|
|
56
|
+
*/
|
|
57
|
+
static get FOCUS_IN() {
|
|
58
|
+
return "focusin";
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @description focusOut イベントオブジェクトの type プロパティ値を定義します。
|
|
62
|
+
* Defines the value of the type property of a focusOut event object.
|
|
63
|
+
*
|
|
64
|
+
* @return {string}
|
|
65
|
+
* @const
|
|
66
|
+
* @static
|
|
67
|
+
*/
|
|
68
|
+
static get FOCUS_OUT() {
|
|
69
|
+
return "focusout";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { IURLRequestHeader } from "./interface/IURLRequestHeader";
|
|
2
|
+
import { Event } from "./Event";
|
|
3
|
+
/**
|
|
4
|
+
* @description ネットワーク要求が HTTP ステータスコードを返すと、アプリケーションによって HTTPStatusEvent オブジェクトが送出されます。
|
|
5
|
+
* The application dispatches HTTPStatusEvent objects when a network request returns an HTTP status code.
|
|
6
|
+
*
|
|
7
|
+
* @class
|
|
8
|
+
* @memberOf next2d.events
|
|
9
|
+
* @extends Event
|
|
10
|
+
*/
|
|
11
|
+
export declare class HTTPStatusEvent extends Event {
|
|
12
|
+
/**
|
|
13
|
+
* @description サーバーから返された HTTP ステータスコードです。
|
|
14
|
+
* The HTTP status code returned by the server.
|
|
15
|
+
*
|
|
16
|
+
* @return {number}
|
|
17
|
+
* @readonly
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
readonly status: number;
|
|
21
|
+
/**
|
|
22
|
+
* @description 返された応答ヘッダー(URLRequestHeader オブジェクトの配列)です。
|
|
23
|
+
* The response headers that the response returned,
|
|
24
|
+
* as an array of URLRequestHeader objects.
|
|
25
|
+
*
|
|
26
|
+
* @return {array}
|
|
27
|
+
* @readonly
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
readonly responseHeaders: IURLRequestHeader[];
|
|
31
|
+
/**
|
|
32
|
+
* @description 応答の返送元の URL です。
|
|
33
|
+
* The URL that the response was returned from.
|
|
34
|
+
*
|
|
35
|
+
* @return {string}
|
|
36
|
+
* @readonly
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
39
|
+
readonly responseURL: string;
|
|
40
|
+
/**
|
|
41
|
+
* @param {string} type
|
|
42
|
+
* @param {boolean} [bubbles=false]
|
|
43
|
+
* @param {number} [status=0]
|
|
44
|
+
* @param {string} [response_url=""]
|
|
45
|
+
* @param {array} [response_headers=[]]
|
|
46
|
+
*
|
|
47
|
+
* @constructor
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
constructor(type: string, bubbles?: boolean, status?: number, response_url?: string, response_headers?: IURLRequestHeader[]);
|
|
51
|
+
/**
|
|
52
|
+
* @description HTTPStatusEvent.HTTP_STATUS 定数は、
|
|
53
|
+
* httpStatus イベントオブジェクトの type プロパティの値を定義します。
|
|
54
|
+
* The HTTPStatusEvent.HTTP_STATUS constant defines the value
|
|
55
|
+
* of the type property of a httpStatus event object.
|
|
56
|
+
*
|
|
57
|
+
* @return {string}
|
|
58
|
+
* @default "httpStatus"
|
|
59
|
+
* @const
|
|
60
|
+
* @static
|
|
61
|
+
*/
|
|
62
|
+
static get HTTP_STATUS(): string;
|
|
63
|
+
}
|