Skip to content

Commit a2e1aa2

Browse files
authored
feat(core): export additional properties for plugin usage (NativeScript#8835)
1 parent c762383 commit a2e1aa2

File tree

4 files changed

+26
-27
lines changed

4 files changed

+26
-27
lines changed

packages/core/index.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
export type { NativeScriptConfig } from './config';
99
export { iOSApplication, AndroidApplication } from './application';
1010
export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application';
11-
import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application';
11+
import { systemAppearanceChanged, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, systemAppearance } from './application';
1212
export declare const Application: {
1313
launchEvent: string;
1414
displayedEvent: string;
@@ -32,6 +32,8 @@ export declare const Application: {
3232
addCss: typeof addCss;
3333
on: typeof on;
3434
off: typeof off;
35+
notify: typeof notify;
36+
hasListeners: typeof hasListeners;
3537
run: typeof run;
3638
orientation: typeof orientation;
3739
getNativeApplication: typeof getNativeApplication;
@@ -113,6 +115,10 @@ export declare const Utils: {
113115
android: typeof androidUtils;
114116
ad: typeof androidUtils;
115117
ios: typeof iosUtils;
118+
setTimeout: typeof setTimeout;
119+
setInterval: typeof setInterval;
120+
clearInterval: typeof clearInterval;
121+
clearTimeout: typeof clearTimeout;
116122
Source: typeof Source;
117123
ClassInfo: typeof ClassInfo;
118124
getClass: typeof getClass;

packages/core/index.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ nsGlobals.initGlobal();
66
export { iOSApplication, AndroidApplication } from './application';
77
export type { ApplicationEventData, LaunchEventData, OrientationChangedEventData, UnhandledErrorEventData, DiscardedErrorEventData, CssChangedEventData, LoadAppCSSEventData, AndroidActivityEventData, AndroidActivityBundleEventData, AndroidActivityRequestPermissionsEventData, AndroidActivityResultEventData, AndroidActivityNewIntentEventData, AndroidActivityBackPressedEventData, SystemAppearanceChangedEventData } from './application';
88

9-
import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application';
9+
import { launchEvent, displayedEvent, uncaughtErrorEvent, discardedErrorEvent, suspendEvent, resumeEvent, exitEvent, lowMemoryEvent, orientationChangedEvent, systemAppearanceChanged, systemAppearanceChangedEvent, getMainEntry, getRootView, _resetRootView, getResources, setResources, setCssFileName, getCssFileName, loadAppCss, addCss, on, off, notify, hasListeners, run, orientation, getNativeApplication, hasLaunched, android as appAndroid, ios as iosApp, systemAppearance } from './application';
1010
export const Application = {
1111
launchEvent,
1212
displayedEvent,
@@ -30,7 +30,9 @@ export const Application = {
3030
loadAppCss,
3131
addCss,
3232
on,
33-
off,
33+
off,
34+
notify,
35+
hasListeners,
3436
run,
3537
orientation,
3638
getNativeApplication,
@@ -103,7 +105,8 @@ export { profile, enable as profilingEnable, disable as profilingDisable, time a
103105
export type { InstrumentationMode, TimerInfo } from './profiling';
104106

105107
export { encoding } from './text';
106-
108+
// for developers to be explicit if they desire around globals (allows access via Utils below)
109+
import { setTimeout, setInterval, clearInterval, clearTimeout } from './timer';
107110
export * from './trace';
108111

109112
export * from './ui';
@@ -133,7 +136,11 @@ export const Utils = {
133136
android: androidUtils,
134137
// legacy (a lot of plugins use the shorthand "ad" Utils.ad instead of Utils.android)
135138
ad: androidUtils,
136-
ios: iosUtils,
139+
ios: iosUtils,
140+
setTimeout,
141+
setInterval,
142+
clearInterval,
143+
clearTimeout,
137144
Source,
138145
ClassInfo,
139146
getClass,

packages/core/ui/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export type { TabStripItemEventData } from './tab-navigation-base/tab-strip';
7474
export { TabStripItem } from './tab-navigation-base/tab-strip-item';
7575
export { TabView, TabViewItem } from './tab-view';
7676
export { Tabs } from './tabs';
77-
export { TextBase, getTransformedText } from './text-base';
77+
export { TextBase, getTransformedText, letterSpacingProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, whiteSpaceProperty, lineHeightProperty } from './text-base';
7878
export type { TextTransform } from './text-base';
7979
export { FormattedString } from './text-base/formatted-string';
8080
export { Span } from './text-base/span';

workspace.json

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -300,12 +300,8 @@
300300
"builder": "@nrwl/workspace:run-commands",
301301
"options": {
302302
"commands": [
303-
{
304-
"command": "./build.sh"
305-
},
306-
{
307-
"command": "cp -R dist/package/platforms/* ../../packages/core/platforms"
308-
}
303+
"./build.sh",
304+
"cp -R dist/package/platforms/* ../../packages/core/platforms"
309305
],
310306
"cwd": "packages/ui-mobile-base",
311307
"parallel": false
@@ -337,12 +333,8 @@
337333
"builder": "@nrwl/workspace:run-commands",
338334
"options": {
339335
"commands": [
340-
{
341-
"command": "npm run tsc"
342-
},
343-
{
344-
"command": "npm run jasmine"
345-
}
336+
"npm run tsc",
337+
"npm run jasmine"
346338
],
347339
"cwd": "packages/webpack",
348340
"parallel": false
@@ -353,15 +345,9 @@
353345
"outputs": ["dist/packages"],
354346
"options": {
355347
"commands": [
356-
{
357-
"command": "npm run setup"
358-
},
359-
{
360-
"command": "mkdir -p ../../dist/packages"
361-
},
362-
{
363-
"command": "mv \"$(npm pack | tail -n 1)\" ../../dist/packages/nativescript-webpack.tgz"
364-
}
348+
"npm run setup",
349+
"mkdir -p ../../dist/packages",
350+
"mv \"$(npm pack | tail -n 1)\" ../../dist/packages/nativescript-webpack.tgz"
365351
],
366352
"cwd": "packages/webpack",
367353
"parallel": false

0 commit comments

Comments
 (0)