mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 01:43:14 +08:00
feat: Node-API engine support (#10710)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
// Definitions.
|
// Definitions.
|
||||||
import { GestureEventData, TapGestureEventData, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, GestureEventDataWithState } from '.';
|
import { GestureEventData, TapGestureEventData, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, GestureEventDataWithState } from '.';
|
||||||
import { View } from '../core/view';
|
import type { View } from '../core/view';
|
||||||
import { EventData } from '../../data/observable';
|
import { EventData } from '../../data/observable';
|
||||||
|
|
||||||
// Types.
|
// Types.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Definitions.
|
// Definitions.
|
||||||
|
|
||||||
import { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from '.';
|
import { GestureEventData, TapGestureEventData, GestureEventDataWithState, SwipeGestureEventData, PanGestureEventData, RotationGestureEventData, PinchGestureEventData } from '.';
|
||||||
import { View } from '../core/view';
|
import type { View } from '../core/view';
|
||||||
import { EventData } from '../../data/observable';
|
import { EventData } from '../../data/observable';
|
||||||
|
|
||||||
// Types.
|
// Types.
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from '.';
|
import { GestureEventData, GestureEventDataWithState, TouchGestureEventData } from '.';
|
||||||
import { Animation } from '../animation';
|
import { Animation } from '../animation';
|
||||||
import { AnimationDefinition } from '../animation/animation-interfaces';
|
import { AnimationDefinition } from '../animation/animation-interfaces';
|
||||||
import { View } from '../core/view';
|
import type { View } from '../core/view';
|
||||||
import { isObject, isFunction } from '../../utils/types';
|
import { isObject, isFunction } from '../../utils/types';
|
||||||
import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-common';
|
import { GestureEvents, GestureStateTypes, GestureTypes } from './gestures-common';
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ export class TouchManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
view.on(View.disposeNativeViewEvent, (args) => {
|
view.on('disposeNativeView', (args) => {
|
||||||
const index = TouchManager.touchHandlers?.findIndex((handler) => handler.view === args.object);
|
const index = TouchManager.touchHandlers?.findIndex((handler) => handler.view === args.object);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
TouchManager.touchHandlers.splice(index, 1);
|
TouchManager.touchHandlers.splice(index, 1);
|
||||||
|
@ -43,7 +43,7 @@ export class Style extends Observable implements StyleDefinition {
|
|||||||
super();
|
super();
|
||||||
|
|
||||||
// HACK: Could not find better way for cross platform WeakRef type checking.
|
// HACK: Could not find better way for cross platform WeakRef type checking.
|
||||||
if (ownerView.constructor.toString().indexOf('[native code]') !== -1) {
|
if (ownerView.constructor.toString().indexOf('[native code]') !== -1 || ownerView.toString() == '[object WeakRef]') {
|
||||||
this.viewRef = <WeakRef<ViewBase>>ownerView;
|
this.viewRef = <WeakRef<ViewBase>>ownerView;
|
||||||
} else {
|
} else {
|
||||||
this.viewRef = new WeakRef(<ViewBase>ownerView);
|
this.viewRef = new WeakRef(<ViewBase>ownerView);
|
||||||
|
4
packages/webpack5/package-lock.json
generated
4
packages/webpack5/package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@nativescript/webpack",
|
"name": "@nativescript/webpack",
|
||||||
"version": "5.0.22",
|
"version": "5.0.23-napi.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@nativescript/webpack",
|
"name": "@nativescript/webpack",
|
||||||
"version": "5.0.22",
|
"version": "5.0.23-napi.0",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
|
@ -59,14 +59,15 @@ if (module.hot) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const checkAndApply = async () => {
|
// Important: Keep as function and not fat arrow; at the moment hermes does not support them
|
||||||
|
const checkAndApply = async function () {
|
||||||
hash = __webpack_require__.h();
|
hash = __webpack_require__.h();
|
||||||
const modules = await module.hot.check().catch((error) => {
|
const modules = await module.hot.check().catch((error) => {
|
||||||
return setStatus(
|
return setStatus(
|
||||||
hash,
|
hash,
|
||||||
'failure',
|
'failure',
|
||||||
'Failed to check.',
|
'Failed to check.',
|
||||||
error.message || error.stack
|
error.message || error.stack,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ if (module.hot) {
|
|||||||
hash,
|
hash,
|
||||||
'failure',
|
'failure',
|
||||||
'Failed to apply.',
|
'Failed to apply.',
|
||||||
error.message || error.stack
|
error.message || error.stack,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user