@grame/faustwasm 0.8.0 → 0.8.2

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.
@@ -135,6 +135,36 @@ async function createFaustUI(divFaustUI, faustNode) {
135
135
  faustUI.resize();
136
136
  };
137
137
 
138
+ async function requestPermissions() {
139
+
140
+ // Explicitly request permission on iOS before calling startSensors()
141
+ if (typeof window.DeviceMotionEvent !== "undefined" && typeof window.DeviceMotionEvent.requestPermission === "function") {
142
+ try {
143
+ const permissionState = await window.DeviceMotionEvent.requestPermission();
144
+ if (permissionState !== "granted") {
145
+ console.warn("Motion sensor permission denied.");
146
+ } else {
147
+ console.log("Motion sensor permission granted.");
148
+ }
149
+ } catch (error) {
150
+ console.error("Error requesting motion sensor permission:", error);
151
+ }
152
+ }
153
+
154
+ if (typeof window.DeviceOrientationEvent !== "undefined" && typeof window.DeviceOrientationEvent.requestPermission === "function") {
155
+ try {
156
+ const permissionState = await window.DeviceOrientationEvent.requestPermission();
157
+ if (permissionState !== "granted") {
158
+ console.warn("Orientation sensor permission denied.");
159
+ } else {
160
+ console.log("Orientation sensor permission granted.");
161
+ }
162
+ } catch (error) {
163
+ console.error("Error requesting orientation sensor permission:", error);
164
+ }
165
+ }
166
+ }
167
+
138
168
  // Export the functions
139
- export { createFaustNode, createFaustUI, connectToAudioInput };
169
+ export { createFaustNode, createFaustUI, connectToAudioInput, requestPermissions };
140
170
 
@@ -946,10 +946,10 @@ class Group extends _AbstractComponent__WEBPACK_IMPORTED_MODULE_0__["default"] {
946
946
  if (!metaIn) return { metaObject };
947
947
  metaIn.forEach((m) => Object.assign(metaObject, m));
948
948
  if (metaObject.style) {
949
- const enumsRegex = /\{(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?);)+(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))\}/;
949
+ const enumsRegex = /\{(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+);)+(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+))\}/;
950
950
  const matched = metaObject.style.match(enumsRegex);
951
951
  if (matched) {
952
- const itemsRegex = /(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+?))/g;
952
+ const itemsRegex = /(?:(?:'|_|-)(.+?)(?:'|_|-):([-+]?[0-9]*\.?[0-9]+))/g;
953
953
  const enums = {};
954
954
  let item;
955
955
  while (item = itemsRegex.exec(matched[0])) {