Skip to content

Commit

Permalink
Remove dispatchEvent solution
Browse files Browse the repository at this point in the history
  • Loading branch information
rexrainbow committed Sep 26, 2023
1 parent 057fffc commit 315a4dd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
3 changes: 1 addition & 2 deletions plugins/behaviors/filechooser/Open.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Note: Not working in iOS9+

import CreateFileInput from './CreateFileInput.js';
import Click from '../../gameobjects/dom/filechooser/Click.js';
import ClickPromise from '../../gameobjects/dom/filechooser/ClickPromise.js';

const GetValue = Phaser.Utils.Objects.GetValue;
Expand All @@ -11,7 +10,7 @@ var Open = function (game, config) {
// game: game, scene, or game object
var closeDelay = GetValue(config, 'closeDelay', 200);
var fileInput = CreateFileInput(game, config);
Click(fileInput);
fileInput.click();
return ClickPromise({ game, fileInput, closeDelay })
.then(function (result) {
RemoveFromDOM(fileInput);
Expand Down
16 changes: 0 additions & 16 deletions plugins/gameobjects/dom/filechooser/Click.js

This file was deleted.

3 changes: 1 addition & 2 deletions plugins/gameobjects/dom/filechooser/FileChooser.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Resize from '../utils/Resize.js';
import SyncTo from '../utils/SyncTo.js';
import LoadFileMethods from '../utils/LoadFileMethods.js';
import Click from './Click.js';
import ClickPromose from './ClickPromise.js';

const DOMElement = Phaser.GameObjects.DOMElement;
Expand Down Expand Up @@ -96,7 +95,7 @@ class FileChooser extends DOMElement {
}

open() { // Only work under any touch event
Click(this.fileInput);
this.fileInput.click();
return this;
}

Expand Down

0 comments on commit 315a4dd

Please sign in to comment.