From f93c6ed7d4f21c19cc13c5ef0eb3e3d1fa1d20bf Mon Sep 17 00:00:00 2001 From: PP Date: Thu, 22 Oct 2020 20:32:01 +0800 Subject: [PATCH] update jsb-editbox adapter to ES6 (#7584) --- port/native/engine/jsb-editbox.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/port/native/engine/jsb-editbox.js b/port/native/engine/jsb-editbox.js index ec1698f9b8..25b22de634 100644 --- a/port/native/engine/jsb-editbox.js +++ b/port/native/engine/jsb-editbox.js @@ -29,7 +29,6 @@ } const EditBox = cc.EditBoxComponent; - const js = cc.js; const KeyboardReturnType = EditBox.KeyboardReturnType; const InputMode = EditBox.InputMode; const InputFlag = EditBox.InputFlag; @@ -72,21 +71,14 @@ } const BaseClass = EditBox._EditBoxImpl; - function JsbEditBoxImpl () { - BaseClass.call(this); - } - - js.extend(JsbEditBoxImpl, BaseClass); - EditBox._EditBoxImpl = JsbEditBoxImpl; - - Object.assign(JsbEditBoxImpl.prototype, { + class JsbEditBoxImpl extends BaseClass { init (delegate) { if (!delegate) { cc.error('EditBox init failed'); return; } this._delegate = delegate; - }, + } beginEditing () { let self = this; @@ -143,7 +135,7 @@ }); this._editing = true; delegate._editBoxEditingDidBegan(); - }, + } endEditing () { this._editing = false; @@ -152,7 +144,7 @@ } jsb.inputBox.hide(); this._delegate._editBoxEditingDidEnded(); - }, + } setMaxLength (maxLength) { if (!isNaN(maxLength)) { @@ -163,7 +155,7 @@ } this._maxLength = maxLength; } - }, + } _getRect () { let node = this._delegate.node; @@ -202,6 +194,7 @@ width: width * finalScaleX, height: height * finaleScaleY }; - }, - }); + } + } + EditBox._EditBoxImpl = JsbEditBoxImpl; }());