ableton-js 3.1.8 → 3.2.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.
@@ -37,6 +37,8 @@ class Socket(object):
37
37
  self.input_handler = handler
38
38
  self._server_addr = ("127.0.0.1", 0)
39
39
  self._client_addr = ("127.0.0.1", 39031)
40
+ self._port_file_last_modified = 0
41
+ self._last_error = ""
40
42
  self._socket = None
41
43
 
42
44
  self.read_remote_port()
@@ -46,6 +48,11 @@ class Socket(object):
46
48
  interval=1000, repeat=True)
47
49
  self.file_timer.start()
48
50
 
51
+ def log_once(self, msg):
52
+ if self._last_error != msg:
53
+ self._last_error = msg
54
+ self.log_message(msg)
55
+
49
56
  def read_last_server_port(self):
50
57
  try:
51
58
  with open(server_port_path) as file:
@@ -60,6 +67,22 @@ class Socket(object):
60
67
 
61
68
  def read_remote_port(self):
62
69
  '''Reads the port our client is listening on'''
70
+
71
+ try:
72
+ file = os.stat(client_port_path)
73
+
74
+ print("Client port file modified: " + str(file.st_mtime) +
75
+ " – last: " + str(self._port_file_last_modified))
76
+
77
+ if file.st_mtime > self._port_file_last_modified:
78
+ self._port_file_last_modified = file.st_mtime
79
+ else:
80
+ # If the file hasn't changed, don't try to open it
81
+ return
82
+ except Exception as e:
83
+ self.log_once("Couldn't stat remote port file: " + str(e.args))
84
+ return
85
+
63
86
  try:
64
87
  old_port = self._client_addr[1]
65
88
 
@@ -74,7 +97,7 @@ class Socket(object):
74
97
  if self._socket:
75
98
  self.send("connect", {"port": self._server_addr[1]})
76
99
  except Exception as e:
77
- self.log_message("Couldn't read file: " + str(e.args))
100
+ self.log_once("Couldn't read remote port file: " + str(e.args))
78
101
 
79
102
  def shutdown(self):
80
103
  self.log_message("Shutting down...")
@@ -106,7 +129,7 @@ class Socket(object):
106
129
  with open(server_port_path, "w") as file:
107
130
  file.write(str(port))
108
131
  except Exception as e:
109
- self.log_message("Couldn't save port in file: " + str(e.args))
132
+ self.log_once("Couldn't save port in file: " + str(e.args))
110
133
  raise e
111
134
 
112
135
  try:
@@ -124,8 +147,8 @@ class Socket(object):
124
147
  str(self._server_addr) + ': ' + \
125
148
  str(e.args) + ', trying again. ' + \
126
149
  'If this keeps happening, try restarting your computer.'
127
- self.log_message(msg)
128
- self.log_message("Client address: " + str(self._client_addr))
150
+ self.log_once(msg + "(Client address: " +
151
+ str(self._client_addr) + ")")
129
152
  self.show_message(msg)
130
153
  t = Timer(5, self.init_socket)
131
154
  t.start()
@@ -1 +1 @@
1
- version = "3.1.8"
1
+ version = "3.2.0"
@@ -1,8 +1,8 @@
1
1
  import { Ableton } from "..";
2
2
  import { Namespace } from ".";
3
- export declare type DocumentView = "Session" | "Arranger";
4
- export declare type DetailView = "Detail" | "Detail/Clip" | "Detail/DeviceChain";
5
- export declare type View = "Browser" | DocumentView | DetailView;
3
+ export type DocumentView = "Session" | "Arranger";
4
+ export type DetailView = "Detail" | "Detail/Clip" | "Detail/DeviceChain";
5
+ export type View = "Browser" | DocumentView | DetailView;
6
6
  export declare enum NavDirection {
7
7
  Up = 0,
8
8
  Down = 1,
@@ -1,127 +1,41 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
2
  Object.defineProperty(exports, "__esModule", { value: true });
54
3
  exports.ApplicationView = exports.NavDirection = void 0;
55
- var _1 = require(".");
4
+ const _1 = require(".");
56
5
  var NavDirection;
57
6
  (function (NavDirection) {
58
7
  NavDirection[NavDirection["Up"] = 0] = "Up";
59
8
  NavDirection[NavDirection["Down"] = 1] = "Down";
60
9
  NavDirection[NavDirection["Left"] = 2] = "Left";
61
10
  NavDirection[NavDirection["Right"] = 3] = "Right";
62
- })(NavDirection = exports.NavDirection || (exports.NavDirection = {}));
63
- var ApplicationView = /** @class */ (function (_super) {
64
- __extends(ApplicationView, _super);
65
- function ApplicationView(ableton) {
66
- return _super.call(this, ableton, "application-view") || this;
11
+ })(NavDirection || (exports.NavDirection = NavDirection = {}));
12
+ class ApplicationView extends _1.Namespace {
13
+ constructor(ableton) {
14
+ super(ableton, "application-view");
15
+ }
16
+ async availableMainViews() {
17
+ return this.sendCachedCommand("available_main_views");
18
+ }
19
+ async focusView(view) {
20
+ return this.sendCommand("focus_view", [view]);
21
+ }
22
+ async hideView(view) {
23
+ return this.sendCommand("hide_view", [view]);
24
+ }
25
+ async isViewVisible(view, mainWindowOnly = true) {
26
+ return this.sendCommand("is_view_visible", [view, mainWindowOnly]);
27
+ }
28
+ async scrollView(view, direction) {
29
+ return this.sendCommand("scroll_view", [direction, view, true]);
30
+ }
31
+ async showView(view) {
32
+ return this.sendCommand("show_view", [view]);
33
+ }
34
+ async toggleBrowse() {
35
+ return this.sendCommand("toggle_browse");
36
+ }
37
+ async zoomView(view, direction) {
38
+ return this.sendCommand("zoom_view", [direction, view, true]);
67
39
  }
68
- ApplicationView.prototype.availableMainViews = function () {
69
- return __awaiter(this, void 0, void 0, function () {
70
- return __generator(this, function (_a) {
71
- return [2 /*return*/, this.sendCachedCommand("available_main_views")];
72
- });
73
- });
74
- };
75
- ApplicationView.prototype.focusView = function (view) {
76
- return __awaiter(this, void 0, void 0, function () {
77
- return __generator(this, function (_a) {
78
- return [2 /*return*/, this.sendCommand("focus_view", [view])];
79
- });
80
- });
81
- };
82
- ApplicationView.prototype.hideView = function (view) {
83
- return __awaiter(this, void 0, void 0, function () {
84
- return __generator(this, function (_a) {
85
- return [2 /*return*/, this.sendCommand("hide_view", [view])];
86
- });
87
- });
88
- };
89
- ApplicationView.prototype.isViewVisible = function (view, mainWindowOnly) {
90
- if (mainWindowOnly === void 0) { mainWindowOnly = true; }
91
- return __awaiter(this, void 0, void 0, function () {
92
- return __generator(this, function (_a) {
93
- return [2 /*return*/, this.sendCommand("is_view_visible", [view, mainWindowOnly])];
94
- });
95
- });
96
- };
97
- ApplicationView.prototype.scrollView = function (view, direction) {
98
- return __awaiter(this, void 0, void 0, function () {
99
- return __generator(this, function (_a) {
100
- return [2 /*return*/, this.sendCommand("scroll_view", [direction, view, true])];
101
- });
102
- });
103
- };
104
- ApplicationView.prototype.showView = function (view) {
105
- return __awaiter(this, void 0, void 0, function () {
106
- return __generator(this, function (_a) {
107
- return [2 /*return*/, this.sendCommand("show_view", [view])];
108
- });
109
- });
110
- };
111
- ApplicationView.prototype.toggleBrowse = function () {
112
- return __awaiter(this, void 0, void 0, function () {
113
- return __generator(this, function (_a) {
114
- return [2 /*return*/, this.sendCommand("toggle_browse")];
115
- });
116
- });
117
- };
118
- ApplicationView.prototype.zoomView = function (view, direction) {
119
- return __awaiter(this, void 0, void 0, function () {
120
- return __generator(this, function (_a) {
121
- return [2 /*return*/, this.sendCommand("zoom_view", [direction, view, true])];
122
- });
123
- });
124
- };
125
- return ApplicationView;
126
- }(_1.Namespace));
40
+ }
127
41
  exports.ApplicationView = ApplicationView;
@@ -1,65 +1,15 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var tests_1 = require("../util/tests");
3
+ const tests_1 = require("../util/tests");
40
4
  require("jest-extended");
41
- var gettableProps = [
5
+ const gettableProps = [
42
6
  "browse_mode",
43
7
  "focused_document_view",
44
8
  ];
45
- describe("Application", function () {
46
- it("should be able to read all properties without erroring", function () { return __awaiter(void 0, void 0, void 0, function () {
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0: return [4 /*yield*/, tests_1.withAbleton(function (ab) { return __awaiter(void 0, void 0, void 0, function () {
50
- return __generator(this, function (_a) {
51
- switch (_a.label) {
52
- case 0: return [4 /*yield*/, Promise.all(gettableProps.map(function (p) { return ab.application.view.get(p); }))];
53
- case 1:
54
- _a.sent();
55
- return [2 /*return*/];
56
- }
57
- });
58
- }); })];
59
- case 1:
60
- _a.sent();
61
- return [2 /*return*/];
62
- }
9
+ describe("Application", () => {
10
+ it("should be able to read all properties without erroring", async () => {
11
+ await (0, tests_1.withAbleton)(async (ab) => {
12
+ await Promise.all(gettableProps.map((p) => ab.application.view.get(p)));
63
13
  });
64
- }); });
14
+ });
65
15
  });
package/ns/application.js CHANGED
@@ -1,73 +1,15 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (_) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
2
  Object.defineProperty(exports, "__esModule", { value: true });
54
3
  exports.Application = void 0;
55
- var _1 = require(".");
56
- var application_view_1 = require("./application-view");
57
- var Application = /** @class */ (function (_super) {
58
- __extends(Application, _super);
59
- function Application(ableton) {
60
- var _this = _super.call(this, ableton, "application") || this;
61
- _this.view = new application_view_1.ApplicationView(_this.ableton);
62
- return _this;
4
+ const _1 = require(".");
5
+ const application_view_1 = require("./application-view");
6
+ class Application extends _1.Namespace {
7
+ constructor(ableton) {
8
+ super(ableton, "application");
9
+ }
10
+ view = new application_view_1.ApplicationView(this.ableton);
11
+ async pressCurrentDialogButton(index) {
12
+ return this.sendCommand("press_current_dialog_button", [index]);
63
13
  }
64
- Application.prototype.pressCurrentDialogButton = function (index) {
65
- return __awaiter(this, void 0, void 0, function () {
66
- return __generator(this, function (_a) {
67
- return [2 /*return*/, this.sendCommand("press_current_dialog_button", [index])];
68
- });
69
- });
70
- };
71
- return Application;
72
- }(_1.Namespace));
14
+ }
73
15
  exports.Application = Application;
@@ -1,44 +1,8 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
2
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var tests_1 = require("../util/tests");
3
+ const tests_1 = require("../util/tests");
40
4
  require("jest-extended");
41
- var gettableProps = [
5
+ const gettableProps = [
42
6
  "major_version",
43
7
  "minor_version",
44
8
  "bugfix_version",
@@ -47,24 +11,10 @@ var gettableProps = [
47
11
  "current_dialog_message",
48
12
  "current_dialog_button_count",
49
13
  ];
50
- describe("Application", function () {
51
- it("should be able to read all properties without erroring", function () { return __awaiter(void 0, void 0, void 0, function () {
52
- return __generator(this, function (_a) {
53
- switch (_a.label) {
54
- case 0: return [4 /*yield*/, tests_1.withAbleton(function (ab) { return __awaiter(void 0, void 0, void 0, function () {
55
- return __generator(this, function (_a) {
56
- switch (_a.label) {
57
- case 0: return [4 /*yield*/, Promise.all(gettableProps.map(function (p) { return ab.application.get(p); }))];
58
- case 1:
59
- _a.sent();
60
- return [2 /*return*/];
61
- }
62
- });
63
- }); })];
64
- case 1:
65
- _a.sent();
66
- return [2 /*return*/];
67
- }
14
+ describe("Application", () => {
15
+ it("should be able to read all properties without erroring", async () => {
16
+ await (0, tests_1.withAbleton)(async (ab) => {
17
+ await Promise.all(gettableProps.map((p) => ab.application.get(p)));
68
18
  });
69
- }); });
19
+ });
70
20
  });
package/ns/clip-slot.js CHANGED
@@ -1,85 +1,68 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.ClipSlot = exports.PlayingStatus = void 0;
19
- var _1 = require(".");
20
- var color_1 = require("../util/color");
21
- var clip_1 = require("./clip");
4
+ const _1 = require(".");
5
+ const color_1 = require("../util/color");
6
+ const clip_1 = require("./clip");
22
7
  var PlayingStatus;
23
8
  (function (PlayingStatus) {
24
9
  PlayingStatus["Stopped"] = "stopped";
25
10
  PlayingStatus["Playing"] = "playing";
26
11
  PlayingStatus["Recording"] = "recording";
27
- })(PlayingStatus = exports.PlayingStatus || (exports.PlayingStatus = {}));
12
+ })(PlayingStatus || (exports.PlayingStatus = PlayingStatus = {}));
28
13
  /**
29
14
  * This class represents an entry in Live's Session view matrix.
30
15
  */
31
- var ClipSlot = /** @class */ (function (_super) {
32
- __extends(ClipSlot, _super);
33
- function ClipSlot(ableton, raw) {
34
- var _this = _super.call(this, ableton, "clip_slot", raw.id) || this;
35
- _this.raw = raw;
36
- _this.transformers = {
37
- clip: function (c) { return (c ? new clip_1.Clip(ableton, c) : null); },
38
- color: function (c) { return new color_1.Color(c); },
16
+ class ClipSlot extends _1.Namespace {
17
+ raw;
18
+ constructor(ableton, raw) {
19
+ super(ableton, "clip_slot", raw.id);
20
+ this.raw = raw;
21
+ this.transformers = {
22
+ clip: (c) => (c ? new clip_1.Clip(ableton, c) : null),
23
+ color: (c) => new color_1.Color(c),
39
24
  };
40
- _this.cachedProps = {
25
+ this.cachedProps = {
41
26
  clip: true,
42
27
  };
43
- return _this;
44
28
  }
45
29
  /**
46
30
  * Creates an empty clip with the given length in the slot.
47
31
  * Throws an error when called on non-empty slots or slots in non-MIDI tracks.
48
32
  */
49
- ClipSlot.prototype.createClip = function (length) {
33
+ createClip(length) {
50
34
  return this.sendCommand("create_clip", [length]);
51
- };
35
+ }
52
36
  /**
53
37
  * Removes the clip contained in the slot.
54
38
  * Raises an exception if the slot was empty.
55
39
  */
56
- ClipSlot.prototype.deleteClip = function () {
40
+ deleteClip() {
57
41
  return this.sendCommand("delete_clip");
58
- };
59
- ClipSlot.prototype.duplicateClipTo = function (slot) {
42
+ }
43
+ duplicateClipTo(slot) {
60
44
  return this.sendCommand("duplicate_clip_to", { slot_id: slot.raw.id });
61
- };
45
+ }
62
46
  /**
63
47
  * Fire a Clip if this Clipslot owns one,
64
48
  * else trigger the stop button, if we have one.
65
49
  */
66
- ClipSlot.prototype.fire = function () {
50
+ fire() {
67
51
  return this.sendCommand("fire");
68
- };
52
+ }
69
53
  /**
70
54
  * Set the ClipSlot's fire button state directly.
71
55
  * Supports all launch modes.
72
56
  */
73
- ClipSlot.prototype.setFireButtonState = function (state) {
57
+ setFireButtonState(state) {
74
58
  return this.sendCommand("set_fire_button_state", [state]);
75
- };
59
+ }
76
60
  /**
77
61
  * Stop playing the contained Clip,
78
62
  * if there is a Clip and its currently playing.
79
63
  */
80
- ClipSlot.prototype.stop = function () {
64
+ stop() {
81
65
  return this.sendCommand("stop");
82
- };
83
- return ClipSlot;
84
- }(_1.Namespace));
66
+ }
67
+ }
85
68
  exports.ClipSlot = ClipSlot;