Просмотр исходного кода

A-Frame plugin: rename event to arstarted

customisations
alemart 6 месяцев назад
Родитель
Сommit
a2e2ccefc1
2 измененных файлов: 7 добавлений и 4 удалений
  1. 4
    2
      docs/api/plugin-aframe.md
  2. 3
    2
      plugins/aframe-with-encantar.js

+ 4
- 2
docs/api/plugin-aframe.md Просмотреть файл

@@ -448,9 +448,11 @@ A corresponding `THREE.Ray`.
448 448
 
449 449
 ## Events
450 450
 
451
-### ar-started
451
+### arstarted
452 452
 
453
-The `ar-started` event is emitted when the main loop of the AR scene is set up, just after the AR session starts.
453
+This event is emitted on the scene when the main loop of the AR scene is set up, just after the AR session starts.
454
+
455
+*Since:* 0.4.2. Previously, this event was called *ar-started*.
454 456
 
455 457
 **Details**
456 458
 

+ 3
- 2
plugins/aframe-with-encantar.js Просмотреть файл

@@ -189,7 +189,7 @@ AFRAME.registerSystem('ar', Object.assign(ARBaseSystem(), {
189 189
         scene.setAttribute('renderer', { alpha: true });
190 190
 
191 191
         // pause the scene until we're ready
192
-        scene.addEventListener('ar-started', () => {
192
+        scene.addEventListener('arstarted', () => {
193 193
             scene.play();
194 194
         });
195 195
         scene.addEventListener('loaded', () => {
@@ -252,7 +252,8 @@ AFRAME.registerSystem('ar', Object.assign(ARBaseSystem(), {
252 252
 
253 253
             // we're done!
254 254
             const scene = this.el;
255
-            scene.emit('ar-started', { ar: this });
255
+            scene.emit('arstarted', { ar: this });
256
+            scene.emit('ar-started', { ar: this }); // backwards compatibility with 0.3.0 - 0.4.1
256 257
             return session;
257 258
         })
258 259
         .catch(error => {

Загрузка…
Отмена
Сохранить