@wailsio/runtime 3.0.0-alpha.7 → 3.0.0-alpha.72

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.
Files changed (59) hide show
  1. package/{application.js → dist/application.js} +32 -46
  2. package/dist/browser.js +20 -0
  3. package/dist/callable.js +144 -0
  4. package/dist/calls.js +194 -0
  5. package/dist/cancellable.js +792 -0
  6. package/dist/clipboard.js +30 -0
  7. package/dist/contextmenu.js +80 -0
  8. package/dist/create.js +94 -0
  9. package/dist/dialogs.js +134 -0
  10. package/dist/drag.js +222 -0
  11. package/dist/event_types.js +232 -0
  12. package/dist/events.js +114 -0
  13. package/dist/flags.js +23 -0
  14. package/dist/index.js +42 -0
  15. package/dist/listener.js +44 -0
  16. package/dist/nanoid.js +38 -0
  17. package/dist/runtime.js +63 -0
  18. package/{screens.js → dist/screens.js} +38 -45
  19. package/dist/system.js +146 -0
  20. package/dist/utils.js +95 -0
  21. package/dist/window.js +570 -0
  22. package/dist/wml.js +179 -0
  23. package/package.json +62 -18
  24. package/types/application.d.ts +12 -0
  25. package/types/browser.d.ts +6 -0
  26. package/types/callable.d.ts +3 -0
  27. package/types/calls.d.ts +63 -0
  28. package/types/cancellable.d.ts +434 -0
  29. package/types/clipboard.d.ts +13 -0
  30. package/types/contextmenu.d.ts +1 -0
  31. package/types/create.d.ts +31 -0
  32. package/types/dialogs.d.ts +140 -0
  33. package/types/drag.d.ts +1 -0
  34. package/types/event_types.d.ts +221 -0
  35. package/types/events.d.ts +67 -0
  36. package/types/flags.d.ts +7 -0
  37. package/types/index.d.ts +16 -0
  38. package/types/listener.d.ts +9 -0
  39. package/types/nanoid.d.ts +1 -0
  40. package/types/runtime.d.ts +22 -0
  41. package/types/screens.d.ts +60 -0
  42. package/types/system.d.ts +92 -0
  43. package/types/utils.d.ts +21 -0
  44. package/types/window.d.ts +306 -0
  45. package/types/wml.d.ts +8 -0
  46. package/browser.js +0 -24
  47. package/calls.js +0 -123
  48. package/clipboard.js +0 -35
  49. package/contextmenu.js +0 -98
  50. package/dialogs.js +0 -138
  51. package/drag.js +0 -125
  52. package/events.js +0 -134
  53. package/flags.js +0 -63
  54. package/index.js +0 -56
  55. package/runtime.js +0 -122
  56. package/system.js +0 -122
  57. package/types.d.ts +0 -135
  58. package/window.js +0 -122
  59. package/wml.js +0 -151
package/dialogs.js DELETED
@@ -1,138 +0,0 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- /* jshint esversion: 9 */
12
-
13
- /**
14
- * @typedef {import("./types").MessageDialogOptions} MessageDialogOptions
15
- * @typedef {import("./types").OpenDialogOptions} OpenDialogOptions
16
- * @typedef {import("./types").SaveDialogOptions} SaveDialogOptions
17
- */
18
-
19
- import {newRuntimeCallerWithID, objectNames} from "./runtime";
20
-
21
- import { nanoid } from 'nanoid/non-secure';
22
-
23
- // Define constants from the `methods` object in Title Case
24
- const DialogInfo = 0;
25
- const DialogWarning = 1;
26
- const DialogError = 2;
27
- const DialogQuestion = 3;
28
- const DialogOpenFile = 4;
29
- const DialogSaveFile = 5;
30
-
31
- const call = newRuntimeCallerWithID(objectNames.Dialog, '');
32
- const dialogResponses = new Map();
33
-
34
- /**
35
- * Generates a unique id that is not present in dialogResponses.
36
- * @returns {string} unique id
37
- */
38
- function generateID() {
39
- let result;
40
- do {
41
- result = nanoid();
42
- } while (dialogResponses.has(result));
43
- return result;
44
- }
45
-
46
- /**
47
- * Shows a dialog of specified type with the given options.
48
- * @param {number} type - type of dialog
49
- * @param {object} options - options for the dialog
50
- * @returns {Promise} promise that resolves with result of dialog
51
- */
52
- function dialog(type, options = {}) {
53
- const id = generateID();
54
- options["dialog-id"] = id;
55
- return new Promise((resolve, reject) => {
56
- dialogResponses.set(id, {resolve, reject});
57
- call(type, options).catch((error) => {
58
- reject(error);
59
- dialogResponses.delete(id);
60
- });
61
- });
62
- }
63
-
64
- /**
65
- * Handles the callback from a dialog.
66
- *
67
- * @param {string} id - The ID of the dialog response.
68
- * @param {string} data - The data received from the dialog.
69
- * @param {boolean} isJSON - Flag indicating whether the data is in JSON format.
70
- *
71
- * @return {undefined}
72
- */
73
- export function dialogCallback(id, data, isJSON) {
74
- let p = dialogResponses.get(id);
75
- if (p) {
76
- if (isJSON) {
77
- p.resolve(JSON.parse(data));
78
- } else {
79
- p.resolve(data);
80
- }
81
- dialogResponses.delete(id);
82
- }
83
- }
84
-
85
- /**
86
- * Callback function for handling errors in dialog.
87
- *
88
- * @param {string} id - The id of the dialog response.
89
- * @param {string} message - The error message.
90
- *
91
- * @return {void}
92
- */
93
- export function dialogErrorCallback(id, message) {
94
- let p = dialogResponses.get(id);
95
- if (p) {
96
- p.reject(message);
97
- dialogResponses.delete(id);
98
- }
99
- }
100
-
101
-
102
- // Replace `methods` with constants in Title Case
103
-
104
- /**
105
- * @param {MessageDialogOptions} options - Dialog options
106
- * @returns {Promise<string>} - The label of the button pressed
107
- */
108
- export const Info = (options) => dialog(DialogInfo, options);
109
-
110
- /**
111
- * @param {MessageDialogOptions} options - Dialog options
112
- * @returns {Promise<string>} - The label of the button pressed
113
- */
114
- export const Warning = (options) => dialog(DialogWarning, options);
115
-
116
- /**
117
- * @param {MessageDialogOptions} options - Dialog options
118
- * @returns {Promise<string>} - The label of the button pressed
119
- */
120
- export const Error = (options) => dialog(DialogError, options);
121
-
122
- /**
123
- * @param {MessageDialogOptions} options - Dialog options
124
- * @returns {Promise<string>} - The label of the button pressed
125
- */
126
- export const Question = (options) => dialog(DialogQuestion, options);
127
-
128
- /**
129
- * @param {OpenDialogOptions} options - Dialog options
130
- * @returns {Promise<string[]|string>} Returns selected file or list of files. Returns blank string if no file is selected.
131
- */
132
- export const OpenFile = (options) => dialog(DialogOpenFile, options);
133
-
134
- /**
135
- * @param {SaveDialogOptions} options - Dialog options
136
- * @returns {Promise<string>} Returns the selected file. Returns blank string if no file is selected.
137
- */
138
- export const SaveFile = (options) => dialog(DialogSaveFile, options);
package/drag.js DELETED
@@ -1,125 +0,0 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- /* jshint esversion: 9 */
12
-
13
- import {invoke, IsWindows} from "./system";
14
- import {GetFlag} from "./flags";
15
-
16
- let shouldDrag = false;
17
- let resizeEdge = null;
18
- let resizable = false;
19
- let defaultCursor = "auto";
20
- window._wails = window._wails || {};
21
- window._wails.setResizable = setResizable;
22
- window._wails.endDrag = endDrag;
23
-
24
- export function dragTest(e) {
25
- let val = window.getComputedStyle(e.target).getPropertyValue("--webkit-app-region");
26
- if (val && val.trim() !== "drag" || e.buttons !== 1) {
27
- return false;
28
- }
29
- return e.detail === 1;
30
- }
31
-
32
- export function setupDrag() {
33
- window.addEventListener('mousedown', onMouseDown);
34
- window.addEventListener('mousemove', onMouseMove);
35
- window.addEventListener('mouseup', onMouseUp);
36
- }
37
-
38
- export function setResizable(value) {
39
- resizable = value;
40
- }
41
-
42
- export function endDrag() {
43
- document.body.style.cursor = 'default';
44
- shouldDrag = false;
45
- }
46
-
47
- function testResize() {
48
- if( resizeEdge ) {
49
- invoke(`resize:${resizeEdge}`);
50
- return true
51
- }
52
- return false;
53
- }
54
-
55
- function onMouseDown(e) {
56
- if(IsWindows() && testResize() || dragTest(e)) {
57
- shouldDrag = !!isValidDrag(e);
58
- }
59
- }
60
-
61
- function isValidDrag(e) {
62
- // Ignore drag on scrollbars
63
- return !(e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight);
64
- }
65
-
66
- function onMouseUp(e) {
67
- let mousePressed = e.buttons !== undefined ? e.buttons : e.which;
68
- if (mousePressed > 0) {
69
- endDrag();
70
- }
71
- }
72
-
73
- function setResize(cursor = defaultCursor) {
74
- document.documentElement.style.cursor = cursor;
75
- resizeEdge = cursor;
76
- }
77
-
78
- function onMouseMove(e) {
79
- shouldDrag = checkDrag(e);
80
- if (IsWindows() && resizable) {
81
- handleResize(e);
82
- }
83
- }
84
-
85
- function checkDrag(e) {
86
- let mousePressed = e.buttons !== undefined ? e.buttons : e.which;
87
- if(shouldDrag && mousePressed > 0) {
88
- invoke("drag");
89
- return false;
90
- }
91
- return shouldDrag;
92
- }
93
-
94
- function handleResize(e) {
95
- let resizeHandleHeight = GetFlag("system.resizeHandleHeight") || 5;
96
- let resizeHandleWidth = GetFlag("system.resizeHandleWidth") || 5;
97
-
98
- // Extra pixels for the corner areas
99
- let cornerExtra = GetFlag("resizeCornerExtra") || 10;
100
-
101
- let rightBorder = window.outerWidth - e.clientX < resizeHandleWidth;
102
- let leftBorder = e.clientX < resizeHandleWidth;
103
- let topBorder = e.clientY < resizeHandleHeight;
104
- let bottomBorder = window.outerHeight - e.clientY < resizeHandleHeight;
105
-
106
- // Adjust for corners
107
- let rightCorner = window.outerWidth - e.clientX < (resizeHandleWidth + cornerExtra);
108
- let leftCorner = e.clientX < (resizeHandleWidth + cornerExtra);
109
- let topCorner = e.clientY < (resizeHandleHeight + cornerExtra);
110
- let bottomCorner = window.outerHeight - e.clientY < (resizeHandleHeight + cornerExtra);
111
-
112
- // If we aren't on an edge, but were, reset the cursor to default
113
- if (!leftBorder && !rightBorder && !topBorder && !bottomBorder && resizeEdge !== undefined) {
114
- setResize();
115
- }
116
- // Adjusted for corner areas
117
- else if (rightCorner && bottomCorner) setResize("se-resize");
118
- else if (leftCorner && bottomCorner) setResize("sw-resize");
119
- else if (leftCorner && topCorner) setResize("nw-resize");
120
- else if (topCorner && rightCorner) setResize("ne-resize");
121
- else if (leftBorder) setResize("w-resize");
122
- else if (topBorder) setResize("n-resize");
123
- else if (bottomBorder) setResize("s-resize");
124
- else if (rightBorder) setResize("e-resize");
125
- }
package/events.js DELETED
@@ -1,134 +0,0 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- /* jshint esversion: 9 */
12
-
13
- /**
14
- * @typedef {import("./types").WailsEvent} WailsEvent
15
- */
16
- import {newRuntimeCallerWithID, objectNames} from "./runtime";
17
-
18
- const call = newRuntimeCallerWithID(objectNames.Events, '');
19
- const EmitMethod = 0;
20
- const eventListeners = new Map();
21
-
22
- class Listener {
23
- constructor(eventName, callback, maxCallbacks) {
24
- this.eventName = eventName;
25
- this.maxCallbacks = maxCallbacks || -1;
26
- this.Callback = (data) => {
27
- callback(data);
28
- if (this.maxCallbacks === -1) return false;
29
- this.maxCallbacks -= 1;
30
- return this.maxCallbacks === 0;
31
- };
32
- }
33
- }
34
-
35
- export class WailsEvent {
36
- constructor(name, data = null) {
37
- this.name = name;
38
- this.data = data;
39
- }
40
- }
41
-
42
-
43
- window._wails = window._wails || {};
44
- window._wails.dispatchWailsEvent = dispatchWailsEvent;
45
-
46
- export function dispatchWailsEvent(event) {
47
- let listeners = eventListeners.get(event.name);
48
- if (listeners) {
49
- let toRemove = listeners.filter(listener => {
50
- let remove = listener.Callback(event);
51
- if (remove) return true;
52
- });
53
- if (toRemove.length > 0) {
54
- listeners = listeners.filter(l => !toRemove.includes(l));
55
- if (listeners.length === 0) eventListeners.delete(event.name);
56
- else eventListeners.set(event.name, listeners);
57
- }
58
- }
59
- }
60
-
61
- /**
62
- * Register a callback function to be called multiple times for a specific event.
63
- *
64
- * @param {string} eventName - The name of the event to register the callback for.
65
- * @param {function} callback - The callback function to be called when the event is triggered.
66
- * @param {number} maxCallbacks - The maximum number of times the callback can be called for the event. Once the maximum number is reached, the callback will no longer be called.
67
- *
68
- @return {function} - A function that, when called, will unregister the callback from the event.
69
- */
70
- export function OnMultiple(eventName, callback, maxCallbacks) {
71
- let listeners = eventListeners.get(eventName) || [];
72
- const thisListener = new Listener(eventName, callback, maxCallbacks);
73
- listeners.push(thisListener);
74
- eventListeners.set(eventName, listeners);
75
- return () => listenerOff(thisListener);
76
- }
77
-
78
- /**
79
- * Registers a callback function to be executed when the specified event occurs.
80
- *
81
- * @param {string} eventName - The name of the event.
82
- * @param {function} callback - The callback function to be executed. It takes no parameters.
83
- * @return {function} - A function that, when called, will unregister the callback from the event. */
84
- export function On(eventName, callback) { return OnMultiple(eventName, callback, -1); }
85
-
86
- /**
87
- * Registers a callback function to be executed only once for the specified event.
88
- *
89
- * @param {string} eventName - The name of the event.
90
- * @param {function} callback - The function to be executed when the event occurs.
91
- * @return {void@return {function} - A function that, when called, will unregister the callback from the event.
92
- */
93
- export function Once(eventName, callback) { return OnMultiple(eventName, callback, 1); }
94
-
95
- /**
96
- * Removes the specified listener from the event listeners collection.
97
- * If all listeners for the event are removed, the event key is deleted from the collection.
98
- *
99
- * @param {Object} listener - The listener to be removed.
100
- */
101
- function listenerOff(listener) {
102
- const eventName = listener.eventName;
103
- let listeners = eventListeners.get(eventName).filter(l => l !== listener);
104
- if (listeners.length === 0) eventListeners.delete(eventName);
105
- else eventListeners.set(eventName, listeners);
106
- }
107
-
108
-
109
- /**
110
- * Removes event listeners for the specified event names.
111
- *
112
- * @param {string} eventName - The name of the event to remove listeners for.
113
- * @param {...string} additionalEventNames - Additional event names to remove listeners for.
114
- * @return {undefined}
115
- */
116
- export function Off(eventName, ...additionalEventNames) {
117
- let eventsToRemove = [eventName, ...additionalEventNames];
118
- eventsToRemove.forEach(eventName => eventListeners.delete(eventName));
119
- }
120
- /**
121
- * Removes all event listeners.
122
- *
123
- * @function OffAll
124
- * @returns {void}
125
- */
126
- export function OffAll() { eventListeners.clear(); }
127
-
128
- /**
129
- * Emits an event using the given event name.
130
- *
131
- * @param {WailsEvent} event - The name of the event to emit.
132
- * @returns {any} - The result of the emitted event.
133
- */
134
- export function Emit(event) { return call(EmitMethod, event); }
package/flags.js DELETED
@@ -1,63 +0,0 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- /* jshint esversion: 9 */
12
-
13
- let flags = new Map();
14
-
15
- function convertToMap(obj) {
16
- const map = new Map();
17
-
18
- for (const [key, value] of Object.entries(obj)) {
19
- if (typeof value === 'object' && value !== null) {
20
- map.set(key, convertToMap(value)); // Recursively convert nested object
21
- } else {
22
- map.set(key, value);
23
- }
24
- }
25
-
26
- return map;
27
- }
28
-
29
- fetch("/wails/flags").then((response) => {
30
- response.json().then((data) => {
31
- flags = convertToMap(data);
32
- });
33
- });
34
-
35
-
36
- function getValueFromMap(keyString) {
37
- const keys = keyString.split('.');
38
- let value = flags;
39
-
40
- for (const key of keys) {
41
- if (value instanceof Map) {
42
- value = value.get(key);
43
- } else {
44
- value = value[key];
45
- }
46
-
47
- if (value === undefined) {
48
- break;
49
- }
50
- }
51
-
52
- return value;
53
- }
54
-
55
- /**
56
- * Retrieves the value associated with the specified key from the flag map.
57
- *
58
- * @param {string} keyString - The key to retrieve the value for.
59
- * @return {*} - The value associated with the specified key.
60
- */
61
- export function GetFlag(keyString) {
62
- return getValueFromMap(keyString);
63
- }
package/index.js DELETED
@@ -1,56 +0,0 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- import {setupContextMenus} from "./contextmenu";
12
- import {setupDrag} from "./drag";
13
- import {reloadWML} from "./wml";
14
- import {Emit, Off, OffAll, On, Once, OnMultiple, WailsEvent} from './events';
15
- import {ByID, ByName, Plugin} from "./calls";
16
- import {Error, Info, OpenFile, Question, SaveFile, Warning} from "./dialogs";
17
-
18
- export * as Application from "./application";
19
- export * as Browser from "./browser";
20
- export * as Clipboard from "./clipboard";
21
- export * as ContextMenu from "./contextmenu";
22
- export * as Flags from "./flags";
23
- export * as Runtime from "./runtime";
24
- export * as Screens from "./screens";
25
- export * as System from "./system";
26
- export * as Window from "./window";
27
-
28
- export const Events = {
29
- On,
30
- Off,
31
- OnMultiple,
32
- WailsEvent,
33
- OffAll,
34
- Emit,
35
- Once
36
-
37
- }
38
-
39
- export const Call = {
40
- Plugin,
41
- ByID,
42
- ByName
43
- }
44
-
45
- export const Dialogs = {
46
- Info,
47
- Error,
48
- OpenFile, Question, Warning, SaveFile
49
- }
50
-
51
- setupContextMenus();
52
- setupDrag();
53
-
54
- document.addEventListener("DOMContentLoaded", function () {
55
- reloadWML();
56
- });
package/runtime.js DELETED
@@ -1,122 +0,0 @@
1
- /*
2
- _ __ _ __
3
- | | / /___ _(_) /____
4
- | | /| / / __ `/ / / ___/
5
- | |/ |/ / /_/ / / (__ )
6
- |__/|__/\__,_/_/_/____/
7
- The electron alternative for Go
8
- (c) Lea Anthony 2019-present
9
- */
10
-
11
- /* jshint esversion: 9 */
12
- import { nanoid } from 'nanoid/non-secure';
13
-
14
- const runtimeURL = window.location.origin + "/wails/runtime";
15
-
16
- // Object Names
17
- export const objectNames = {
18
- Call: 0,
19
- Clipboard: 1,
20
- Application: 2,
21
- Events: 3,
22
- ContextMenu: 4,
23
- Dialog: 5,
24
- Window: 6,
25
- Screens: 7,
26
- System: 8,
27
- Browser: 9,
28
- }
29
- export let clientId = nanoid();
30
-
31
- /**
32
- * Creates a runtime caller function that invokes a specified method on a given object within a specified window context.
33
- *
34
- * @param {Object} object - The object on which the method is to be invoked.
35
- * @param {string} windowName - The name of the window context in which the method should be called.
36
- * @returns {Function} A runtime caller function that takes the method name and optionally arguments and invokes the method within the specified window context.
37
- */
38
- export function newRuntimeCaller(object, windowName) {
39
- return function (method, args=null) {
40
- return runtimeCall(object + "." + method, windowName, args);
41
- };
42
- }
43
-
44
- /**
45
- * Creates a new runtime caller with specified ID.
46
- *
47
- * @param {object} object - The object to invoke the method on.
48
- * @param {string} windowName - The name of the window.
49
- * @return {Function} - The new runtime caller function.
50
- */
51
- export function newRuntimeCallerWithID(object, windowName) {
52
- return function (method, args=null) {
53
- return runtimeCallWithID(object, method, windowName, args);
54
- };
55
- }
56
-
57
-
58
- function runtimeCall(method, windowName, args) {
59
- let url = new URL(runtimeURL);
60
- if( method ) {
61
- url.searchParams.append("method", method);
62
- }
63
- let fetchOptions = {
64
- headers: {},
65
- };
66
- if (windowName) {
67
- fetchOptions.headers["x-wails-window-name"] = windowName;
68
- }
69
- if (args) {
70
- url.searchParams.append("args", JSON.stringify(args));
71
- }
72
- fetchOptions.headers["x-wails-client-id"] = clientId;
73
-
74
- return new Promise((resolve, reject) => {
75
- fetch(url, fetchOptions)
76
- .then(response => {
77
- if (response.ok) {
78
- // check content type
79
- if (response.headers.get("Content-Type") && response.headers.get("Content-Type").indexOf("application/json") !== -1) {
80
- return response.json();
81
- } else {
82
- return response.text();
83
- }
84
- }
85
- reject(Error(response.statusText));
86
- })
87
- .then(data => resolve(data))
88
- .catch(error => reject(error));
89
- });
90
- }
91
-
92
- function runtimeCallWithID(objectID, method, windowName, args) {
93
- let url = new URL(runtimeURL);
94
- url.searchParams.append("object", objectID);
95
- url.searchParams.append("method", method);
96
- let fetchOptions = {
97
- headers: {},
98
- };
99
- if (windowName) {
100
- fetchOptions.headers["x-wails-window-name"] = windowName;
101
- }
102
- if (args) {
103
- url.searchParams.append("args", JSON.stringify(args));
104
- }
105
- fetchOptions.headers["x-wails-client-id"] = clientId;
106
- return new Promise((resolve, reject) => {
107
- fetch(url, fetchOptions)
108
- .then(response => {
109
- if (response.ok) {
110
- // check content type
111
- if (response.headers.get("Content-Type") && response.headers.get("Content-Type").indexOf("application/json") !== -1) {
112
- return response.json();
113
- } else {
114
- return response.text();
115
- }
116
- }
117
- reject(Error(response.statusText));
118
- })
119
- .then(data => resolve(data))
120
- .catch(error => reject(error));
121
- });
122
- }