diff --git a/application/application-common.ts b/application/application-common.ts index 35a5d93aa..89357cfdf 100644 --- a/application/application-common.ts +++ b/application/application-common.ts @@ -6,7 +6,7 @@ import styleScope = require("ui/styling/style-scope"); import observable = require("data/observable"); var events = new observable.Observable(); -require("utils/module-merge").merge(events, exports); +global.moduleMerge(events, exports); export var launchEvent = "launch"; export var suspendEvent = "suspend"; diff --git a/application/application.android.ts b/application/application.android.ts index 1131a5958..cde2105a8 100644 --- a/application/application.android.ts +++ b/application/application.android.ts @@ -4,9 +4,7 @@ import frame = require("ui/frame"); import types = require("utils/types"); import observable = require("data/observable"); -// merge the exports of the application_common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(appModule, exports); +global.moduleMerge(appModule, exports); export var mainModule: string; diff --git a/application/application.ios.ts b/application/application.ios.ts index 33d9ba433..00d8ca8e9 100644 --- a/application/application.ios.ts +++ b/application/application.ios.ts @@ -5,9 +5,7 @@ import types = require("utils/types"); import view = require("ui/core/view"); import definition = require("application"); -// merge the exports of the application_common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(appModule, exports); +global.moduleMerge(appModule, exports); export var mainModule: string; diff --git a/apps/tests/application-tests.android.ts b/apps/tests/application-tests.android.ts index ca5eb8019..4b453a2be 100644 --- a/apps/tests/application-tests.android.ts +++ b/apps/tests/application-tests.android.ts @@ -3,9 +3,7 @@ import app = require("application"); import TKUnit = require("./TKUnit"); import commonTests = require("./application-tests-common"); -// merge the exports of the application_common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(commonTests, exports); +global.moduleMerge(commonTests, exports); // // ### Using the Android-specific implementation diff --git a/apps/tests/application-tests.ios.ts b/apps/tests/application-tests.ios.ts index 70d45b9c4..44730a6ba 100644 --- a/apps/tests/application-tests.ios.ts +++ b/apps/tests/application-tests.ios.ts @@ -3,9 +3,7 @@ import app = require("application"); import TKUnit = require("./TKUnit"); import commonTests = require("./application-tests-common"); -// merge the exports of the application_common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(commonTests, exports); +global.moduleMerge(commonTests, exports); // // ### Adding a Notification Observer (iOS) diff --git a/apps/tests/ui/action-bar/action-bar-tests.android.ts b/apps/tests/ui/action-bar/action-bar-tests.android.ts index 61f25bd5f..3e38a9296 100644 --- a/apps/tests/ui/action-bar/action-bar-tests.android.ts +++ b/apps/tests/ui/action-bar/action-bar-tests.android.ts @@ -1,4 +1,2 @@ import actionTestsCommon = require("./action-bar-tests-common"); - -declare var exports; -require("utils/module-merge").merge(actionTestsCommon, exports); +global.moduleMerge(actionTestsCommon, exports); \ No newline at end of file diff --git a/apps/tests/ui/action-bar/action-bar-tests.ios.ts b/apps/tests/ui/action-bar/action-bar-tests.ios.ts index 142b747e9..3b4487495 100644 --- a/apps/tests/ui/action-bar/action-bar-tests.ios.ts +++ b/apps/tests/ui/action-bar/action-bar-tests.ios.ts @@ -6,8 +6,7 @@ import helper = require("../helper"); import view = require("ui/core/view"); import actionBar = require("ui/action-bar"); -declare var exports; -require("utils/module-merge").merge(actionTestsCommon, exports); +global.moduleMerge(actionTestsCommon, exports); export function test_NavBar_isVisible_when_MenuItems_areSet() { diff --git a/apps/tests/ui/page/page-tests.android.ts b/apps/tests/ui/page/page-tests.android.ts index 210ac7415..dcfc93eb3 100644 --- a/apps/tests/ui/page/page-tests.android.ts +++ b/apps/tests/ui/page/page-tests.android.ts @@ -5,8 +5,7 @@ import PageTestCommon = require("./page-tests-common"); import helper = require("../helper"); import frame = require("ui/frame"); -declare var exports; -require("utils/module-merge").merge(PageTestCommon, exports); +global.moduleMerge(PageTestCommon, exports); export var test_NavigateToNewPage_WithAndroidCache = function () { var testPage: PageModule.Page; diff --git a/apps/tests/ui/page/page-tests.ios.ts b/apps/tests/ui/page/page-tests.ios.ts index 0a74ea139..f1691d7d8 100644 --- a/apps/tests/ui/page/page-tests.ios.ts +++ b/apps/tests/ui/page/page-tests.ios.ts @@ -4,8 +4,7 @@ import TKUnit = require("../../TKUnit"); import LabelModule = require("ui/label"); import helper = require("../helper"); -declare var exports; -require("utils/module-merge").merge(PageTestCommon, exports); +global.moduleMerge(PageTestCommon, exports); export function test_NavigateToNewPage_InnerControl() { var testPage: PageModule.Page; diff --git a/apps/tests/ui/view/view-tests.android.ts b/apps/tests/ui/view/view-tests.android.ts index 5a26a2757..474af9a80 100644 --- a/apps/tests/ui/view/view-tests.android.ts +++ b/apps/tests/ui/view/view-tests.android.ts @@ -12,9 +12,7 @@ import trace = require("trace"); // enable the trace, it is disabled by default trace.enable(); -// merge the exports of the view-tests-common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(commonTests, exports); +global.moduleMerge(commonTests, exports); export var test_event_onAttached_IsRaised = function () { var listener = new Listener("_onAttached"); diff --git a/apps/tests/ui/view/view-tests.ios.ts b/apps/tests/ui/view/view-tests.ios.ts index 9ccff422d..3934786df 100644 --- a/apps/tests/ui/view/view-tests.ios.ts +++ b/apps/tests/ui/view/view-tests.ios.ts @@ -1,9 +1,7 @@ import commonTests = require("./view-tests-common"); import view = require("ui/core/view"); -// merge the exports of the application_common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(commonTests, exports); +global.moduleMerge(commonTests, exports); export function getNativeBorderWidth(v: view.View): number { return (v.ios).layer.borderWidth; diff --git a/connectivity/connectivity.android.ts b/connectivity/connectivity.android.ts index dbda582f7..9302a17b2 100644 --- a/connectivity/connectivity.android.ts +++ b/connectivity/connectivity.android.ts @@ -2,8 +2,7 @@ import common = require("connectivity/connectivity-common"); import utils = require("utils/utils"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); var WIFI = "WIFI"; var MOBILE = "MOBILE"; diff --git a/connectivity/connectivity.ios.ts b/connectivity/connectivity.ios.ts index fefd1a905..2f7068ceb 100644 --- a/connectivity/connectivity.ios.ts +++ b/connectivity/connectivity.ios.ts @@ -1,7 +1,6 @@ import common = require("connectivity/connectivity-common"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); // Get Connection Type declare var sockaddr; diff --git a/globals/globals.ts b/globals/globals.ts index c7b69747a..2be0fd267 100644 --- a/globals/globals.ts +++ b/globals/globals.ts @@ -3,6 +3,17 @@ import timer = require("timer"); import consoleModule = require("console"); import xhr = require("xhr/xhr"); import dialogs = require("ui/dialogs"); +var fetchModule = require("fetch"); + +// This method iterates all the keys in the source exports object and copies them to the destination exports one. +// Note: the method will not check for naming collisions and will override any already existing entries in the destination exports. +global.moduleMerge = function (sourceExports: any, destExports: any) { + for (var key in sourceExports) { + destExports[key] = sourceExports[key]; + } +} + +global.moduleMerge(fetchModule, global); global.setTimeout = timer.setTimeout; global.clearTimeout = timer.clearTimeout; @@ -18,9 +29,6 @@ global.XMLHttpRequest = xhr.XMLHttpRequest; global.FormData = xhr.FormData; global.alert = dialogs.alert; -var fetchModule = require("fetch"); -require("utils/module-merge").merge(fetchModule, global); - export function Deprecated(target: Object, key?: string | symbol, descriptor?: any) { if (descriptor) { var originalMethod = descriptor.value; diff --git a/http/http.ts b/http/http.ts index c6f2f6c40..d846f241d 100644 --- a/http/http.ts +++ b/http/http.ts @@ -1,9 +1,7 @@ import image = require("image-source"); import httpRequest = require("http/http-request"); -// merge the exports of the request file with the exports of this file -declare var exports; -require("utils/module-merge").merge(httpRequest, exports); +global.moduleMerge(httpRequest, exports); export function getString(arg: any): Promise { return new Promise((resolve, reject) => { diff --git a/image-source/image-source.android.ts b/image-source/image-source.android.ts index 13af389c0..ffa6a89f6 100644 --- a/image-source/image-source.android.ts +++ b/image-source/image-source.android.ts @@ -5,9 +5,7 @@ import common = require("image-source/image-source-common"); import enums = require("ui/enums"); import utils = require("utils/utils"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ImageSource implements definition.ImageSource { public android: android.graphics.Bitmap; diff --git a/image-source/image-source.ios.ts b/image-source/image-source.ios.ts index 548a4dc22..59273d2e0 100644 --- a/image-source/image-source.ios.ts +++ b/image-source/image-source.ios.ts @@ -4,9 +4,7 @@ import fs = require("file-system"); import common = require("image-source/image-source-common"); import enums = require("ui/enums"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ImageSource implements definition.ImageSource { public android: android.graphics.Bitmap; diff --git a/location/location-common.ts b/location/location-common.ts index 3a5ac0a16..eedb85f26 100644 --- a/location/location-common.ts +++ b/location/location-common.ts @@ -2,11 +2,6 @@ //import locationManagerModule = require("location/location-manager"); import defModule = require("location"); -// merge the exports of the types module with the exports of this file -//import merger = require("utils/module-merge"); -//declare var exports; -//merger.merge(locationManagerModule, exports); - var defaultGetLocationTimeout = 20000; export class Location implements defModule.Location { diff --git a/location/location.android.ts b/location/location.android.ts index af4b887df..48aa1fa29 100644 --- a/location/location.android.ts +++ b/location/location.android.ts @@ -3,9 +3,7 @@ import locationModule = require("location"); import common = require("location/location-common"); import utils = require("utils/utils"); -import merger = require("utils/module-merge"); -declare var exports; -merger.merge(common, exports); +global.moduleMerge(common, exports); export class LocationManager implements locationModule.LocationManager { get android(): locationModule.AndroidLocationManager { diff --git a/location/location.ios.ts b/location/location.ios.ts index e172ffa41..6ab05b1e4 100644 --- a/location/location.ios.ts +++ b/location/location.ios.ts @@ -2,9 +2,7 @@ import locationModule = require("location"); import common = require("location/location-common"); -import merger = require("utils/module-merge"); -declare var exports; -merger.merge(common, exports); +global.moduleMerge(common, exports); class LocationListenerImpl extends NSObject implements CLLocationManagerDelegate { public static ObjCProtocols = [CLLocationManagerDelegate]; diff --git a/text/formatted-string.android.ts b/text/formatted-string.android.ts index d2c7b963c..aa139cf76 100644 --- a/text/formatted-string.android.ts +++ b/text/formatted-string.android.ts @@ -1,8 +1,7 @@ import formattedStringCommon = require("text/formatted-string-common"); import spanModule = require("text/span"); -declare var exports; -require("utils/module-merge").merge(formattedStringCommon, exports); +global.moduleMerge(formattedStringCommon, exports); export class FormattedString extends formattedStringCommon.FormattedString { public createFormattedStringCore() { diff --git a/text/formatted-string.ios.ts b/text/formatted-string.ios.ts index 61101ea10..9181946db 100644 --- a/text/formatted-string.ios.ts +++ b/text/formatted-string.ios.ts @@ -1,8 +1,7 @@ import formattedStringCommon = require("text/formatted-string-common"); import spanModule = require("text/span"); -declare var exports; -require("utils/module-merge").merge(formattedStringCommon, exports); +global.moduleMerge(formattedStringCommon, exports); export class FormattedString extends formattedStringCommon.FormattedString { public createFormattedStringCore() { diff --git a/text/span.android.ts b/text/span.android.ts index 02d2fc870..0e7913498 100644 --- a/text/span.android.ts +++ b/text/span.android.ts @@ -3,8 +3,7 @@ import enums = require("ui/enums"); import formattedString = require("text/formatted-string"); import utils = require("utils/utils"); -declare var exports; -require("utils/module-merge").merge(spanCommon, exports); +global.moduleMerge(spanCommon, exports); export class Span extends spanCommon.Span { public updateSpanModifiers(parent: formattedString.FormattedString) { diff --git a/text/span.ios.ts b/text/span.ios.ts index 4cd725203..a38a8910b 100644 --- a/text/span.ios.ts +++ b/text/span.ios.ts @@ -2,8 +2,7 @@ import spanCommon = require("text/span-common"); import enums = require("ui/enums"); import formattedString = require("text/formatted-string"); -declare var exports; -require("utils/module-merge").merge(spanCommon, exports); +global.moduleMerge(spanCommon, exports); export class Span extends spanCommon.Span { public updateSpanModifiers(parent: formattedString.FormattedString) { diff --git a/ui/action-bar/action-bar.android.ts b/ui/action-bar/action-bar.android.ts index 441d86ce7..ed5b4a16f 100644 --- a/ui/action-bar/action-bar.android.ts +++ b/ui/action-bar/action-bar.android.ts @@ -11,8 +11,7 @@ import dts = require("ui/action-bar"); var ACTION_ITEM_ID_OFFSET = 1000; var API_LVL = android.os.Build.VERSION.SDK_INT; -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ActionItem extends common.ActionItemBase implements dts.ActionItem { private _androidPosition: dts.AndroidActionItemSettings = { position: enums.AndroidActionItemPosition.actionBar }; diff --git a/ui/action-bar/action-bar.ios.ts b/ui/action-bar/action-bar.ios.ts index 92f9c4b4b..dc9a21816 100644 --- a/ui/action-bar/action-bar.ios.ts +++ b/ui/action-bar/action-bar.ios.ts @@ -6,8 +6,7 @@ import enums = require("ui/enums"); import view = require("ui/core/view"); import utils = require("utils/utils"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ActionItem extends common.ActionItemBase implements dts.ActionItem { private _ios: dts.IOSActionItemSettings = { position: enums.IOSActionItemPosition.left }; diff --git a/ui/activity-indicator/activity-indicator.android.ts b/ui/activity-indicator/activity-indicator.android.ts index cca36369b..8f6c044e3 100644 --- a/ui/activity-indicator/activity-indicator.android.ts +++ b/ui/activity-indicator/activity-indicator.android.ts @@ -17,9 +17,7 @@ function onBusyPropertyChanged(data: dependencyObservable.PropertyChangeData) { // register the setNativeValue callback (aiCommon.ActivityIndicator.busyProperty.metadata).onSetNativeValue = onBusyPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(aiCommon, exports); +global.moduleMerge(aiCommon, exports); export class ActivityIndicator extends aiCommon.ActivityIndicator { private _android: android.widget.ProgressBar; diff --git a/ui/activity-indicator/activity-indicator.ios.ts b/ui/activity-indicator/activity-indicator.ios.ts index 8f48450ff..d494de54e 100644 --- a/ui/activity-indicator/activity-indicator.ios.ts +++ b/ui/activity-indicator/activity-indicator.ios.ts @@ -18,9 +18,7 @@ function onBusyPropertyChanged(data: dependencyObservable.PropertyChangeData) { // register the setNativeValue callback (aiCommon.ActivityIndicator.busyProperty.metadata).onSetNativeValue = onBusyPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(aiCommon, exports); +global.moduleMerge(aiCommon, exports); export class ActivityIndicator extends aiCommon.ActivityIndicator { private _ios: UIActivityIndicatorView; diff --git a/ui/button/button.android.ts b/ui/button/button.android.ts index 1ab30e586..403c6172d 100644 --- a/ui/button/button.android.ts +++ b/ui/button/button.android.ts @@ -2,9 +2,7 @@ import utils = require("utils/utils"); import trace = require("trace"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Button extends common.Button { private _android: android.widget.Button; diff --git a/ui/button/button.ios.ts b/ui/button/button.ios.ts index 980f094c1..151006ffc 100644 --- a/ui/button/button.ios.ts +++ b/ui/button/button.ios.ts @@ -22,9 +22,7 @@ class TapHandlerImpl extends NSObject { }; } -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Button extends common.Button { private _ios: UIButton; diff --git a/ui/core/view.android.ts b/ui/core/view.android.ts index 0c87e677b..f745ad301 100644 --- a/ui/core/view.android.ts +++ b/ui/core/view.android.ts @@ -6,9 +6,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); import gestures = require("ui/gestures"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(viewCommon, exports); +global.moduleMerge(viewCommon, exports); var ANDROID = "_android"; var NATIVE_VIEW = "_nativeView"; diff --git a/ui/core/view.ios.ts b/ui/core/view.ios.ts index b8051da5b..5f22fa455 100644 --- a/ui/core/view.ios.ts +++ b/ui/core/view.ios.ts @@ -5,9 +5,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); import background = require("ui/styling/background"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(viewCommon, exports); +global.moduleMerge(viewCommon, exports); function onIdPropertyChanged(data: dependencyObservable.PropertyChangeData) { var view = data.object; diff --git a/ui/date-picker/date-picker.android.ts b/ui/date-picker/date-picker.android.ts index ea676e017..34ea427e5 100644 --- a/ui/date-picker/date-picker.android.ts +++ b/ui/date-picker/date-picker.android.ts @@ -63,9 +63,7 @@ function onMinDatePropertyChanged(data: dependencyObservable.PropertyChangeData) (common.DatePicker.minDateProperty.metadata).onSetNativeValue = onMinDatePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class DatePicker extends common.DatePicker { private _android: android.widget.DatePicker; diff --git a/ui/date-picker/date-picker.ios.ts b/ui/date-picker/date-picker.ios.ts index 5305f2c00..c1c16e9d4 100644 --- a/ui/date-picker/date-picker.ios.ts +++ b/ui/date-picker/date-picker.ios.ts @@ -59,9 +59,7 @@ function onMinDatePropertyChanged(data: dependencyObservable.PropertyChangeData) (common.DatePicker.minDateProperty.metadata).onSetNativeValue = onMinDatePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class DatePicker extends common.DatePicker { private _ios: UIDatePicker; diff --git a/ui/dialogs/dialogs.android.ts b/ui/dialogs/dialogs.android.ts index b0b76155b..864631d3c 100644 --- a/ui/dialogs/dialogs.android.ts +++ b/ui/dialogs/dialogs.android.ts @@ -3,13 +3,11 @@ */ import dialogs = require("ui/dialogs"); -import dialogs_common = require("ui/dialogs/dialogs-common"); +import dialogsCommon = require("ui/dialogs/dialogs-common"); import appmodule = require("application"); import types = require("utils/types"); -// merge the exports of the request file with the exports of this file -declare var exports; -require("utils/module-merge").merge(dialogs_common, exports); +global.moduleMerge(dialogsCommon, exports); function createAlertDialog(options?: dialogs.DialogOptions): android.app.AlertDialog.Builder { var alert = new android.app.AlertDialog.Builder(appmodule.android.foregroundActivity); @@ -56,7 +54,7 @@ function addButtonsToAlertDialog(alert: android.app.AlertDialog.Builder, options export function alert(arg: any): Promise { return new Promise((resolve, reject) => { try { - var options = types.isString(arg) ? { title: dialogs_common.ALERT, okButtonText: dialogs_common.OK, message: arg } : arg; + var options = types.isString(arg) ? { title: dialogsCommon.ALERT, okButtonText: dialogsCommon.OK, message: arg } : arg; var alert = createAlertDialog(options); @@ -78,7 +76,7 @@ export function alert(arg: any): Promise { export function confirm(arg: any): Promise { return new Promise((resolve, reject) => { try { - var options = types.isString(arg) ? { title: dialogs_common.CONFIRM, okButtonText: dialogs_common.OK, cancelButtonText: dialogs_common.CANCEL, message: arg } : arg; + var options = types.isString(arg) ? { title: dialogsCommon.CONFIRM, okButtonText: dialogsCommon.OK, cancelButtonText: dialogsCommon.CANCEL, message: arg } : arg; var alert = createAlertDialog(options); addButtonsToAlertDialog(alert, options, function (result) { resolve(result); }); @@ -95,9 +93,9 @@ export function prompt(arg: any): Promise { var options: dialogs.PromptOptions; var defaultOptions = { - title: dialogs_common.PROMPT, - okButtonText: dialogs_common.OK, - cancelButtonText: dialogs_common.CANCEL, + title: dialogsCommon.PROMPT, + okButtonText: dialogsCommon.OK, + cancelButtonText: dialogsCommon.CANCEL, inputType: dialogs.inputType.text, }; @@ -146,7 +144,7 @@ export function prompt(arg: any): Promise { export function login(arg: any): Promise { var options: dialogs.LoginOptions; - var defaultOptions = { title: dialogs_common.LOGIN, okButtonText: dialogs_common.OK, cancelButtonText: dialogs_common.CANCEL }; + var defaultOptions = { title: dialogsCommon.LOGIN, okButtonText: dialogsCommon.OK, cancelButtonText: dialogsCommon.CANCEL }; if (arguments.length === 1) { if (types.isString(arguments[0])) { @@ -211,7 +209,7 @@ export function action(arg: any): Promise { var options: dialogs.ActionOptions; - var defaultOptions = { cancelButtonText: dialogs_common.CANCEL }; + var defaultOptions = { cancelButtonText: dialogsCommon.CANCEL }; if (arguments.length === 1) { if (types.isString(arguments[0])) { diff --git a/ui/dialogs/dialogs.ios.ts b/ui/dialogs/dialogs.ios.ts index 495d96366..e6a987703 100644 --- a/ui/dialogs/dialogs.ios.ts +++ b/ui/dialogs/dialogs.ios.ts @@ -3,14 +3,12 @@ */ import dialogs = require("ui/dialogs"); -import dialogs_common = require("ui/dialogs/dialogs-common"); +import dialogsCommon = require("ui/dialogs/dialogs-common"); import types = require("utils/types"); import utils = require("utils/utils"); import frame = require("ui/frame"); -// merge the exports of the request file with the exports of this file -declare var exports; -require("utils/module-merge").merge(dialogs_common, exports); +global.moduleMerge(dialogsCommon, exports); class UIAlertViewDelegateImpl extends NSObject implements UIAlertViewDelegate { public static ObjCProtocols = [UIAlertViewDelegate]; @@ -140,7 +138,7 @@ function addButtonsToAlertController(alertController: UIAlertController, options export function alert(arg: any): Promise { return new Promise((resolve, reject) => { try { - var options = types.isString(arg) ? { title: dialogs_common.ALERT, okButtonText: dialogs_common.OK, message: arg } : arg; + var options = types.isString(arg) ? { title: dialogsCommon.ALERT, okButtonText: dialogsCommon.OK, message: arg } : arg; if (utils.ios.MajorVersion < 8) { var alert = createUIAlertView(options); @@ -175,7 +173,7 @@ export function alert(arg: any): Promise { export function confirm(arg: any): Promise { return new Promise((resolve, reject) => { try { - var options = types.isString(arg) ? { title: dialogs_common.CONFIRM, okButtonText: dialogs_common.OK, cancelButtonText: dialogs_common.CANCEL, message: arg } : arg; + var options = types.isString(arg) ? { title: dialogsCommon.CONFIRM, okButtonText: dialogsCommon.OK, cancelButtonText: dialogsCommon.CANCEL, message: arg } : arg; if (utils.ios.MajorVersion < 8) { var alert = createUIAlertView(options); @@ -211,9 +209,9 @@ export function prompt(arg: any): Promise { var options: dialogs.PromptOptions; var defaultOptions = { - title: dialogs_common.PROMPT, - okButtonText: dialogs_common.OK, - cancelButtonText: dialogs_common.CANCEL, + title: dialogsCommon.PROMPT, + okButtonText: dialogsCommon.OK, + cancelButtonText: dialogsCommon.CANCEL, inputType: dialogs.inputType.text, }; @@ -287,7 +285,7 @@ export function prompt(arg: any): Promise { export function login(arg: any): Promise { var options: dialogs.LoginOptions; - var defaultOptions = { title: dialogs_common.LOGIN, okButtonText: dialogs_common.OK, cancelButtonText: dialogs_common.CANCEL }; + var defaultOptions = { title: dialogsCommon.LOGIN, okButtonText: dialogsCommon.OK, cancelButtonText: dialogsCommon.CANCEL }; if (arguments.length === 1) { if (types.isString(arguments[0])) { @@ -389,7 +387,7 @@ function showUIAlertController(alertController: UIAlertController) { export function action(arg: any): Promise { var options: dialogs.ActionOptions; - var defaultOptions = { cancelButtonText: dialogs_common.CANCEL }; + var defaultOptions = { cancelButtonText: dialogsCommon.CANCEL }; if (arguments.length === 1) { if (types.isString(arguments[0])) { diff --git a/ui/frame/frame.android.ts b/ui/frame/frame.android.ts index 69c4ce723..782de2f24 100644 --- a/ui/frame/frame.android.ts +++ b/ui/frame/frame.android.ts @@ -7,8 +7,7 @@ import utils = require("utils/utils"); import view = require("ui/core/view"); import application = require("application"); -declare var exports; -require("utils/module-merge").merge(frameCommon, exports); +global.moduleMerge(frameCommon, exports); var TAG = "_fragmentTag"; var OWNER = "_owner"; diff --git a/ui/frame/frame.ios.ts b/ui/frame/frame.ios.ts index 44204b43b..6c0180b18 100644 --- a/ui/frame/frame.ios.ts +++ b/ui/frame/frame.ios.ts @@ -7,8 +7,7 @@ import utils = require("utils/utils"); import view = require("ui/core/view"); import types = require("utils/types"); -declare var exports; -require("utils/module-merge").merge(frameCommon, exports); +global.moduleMerge(frameCommon, exports); var ENTRY = "_entry"; diff --git a/ui/gestures/gestures.android.ts b/ui/gestures/gestures.android.ts index 268c5c463..4278a6601 100644 --- a/ui/gestures/gestures.android.ts +++ b/ui/gestures/gestures.android.ts @@ -4,9 +4,7 @@ import observable = require("data/observable"); import view = require("ui/core/view"); import trace = require("trace"); -// merge the exports of the request file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); var SWIPE_THRESHOLD = 100; var SWIPE_VELOCITY_THRESHOLD = 100; diff --git a/ui/gestures/gestures.ios.ts b/ui/gestures/gestures.ios.ts index d061c2077..86b467fb7 100644 --- a/ui/gestures/gestures.ios.ts +++ b/ui/gestures/gestures.ios.ts @@ -4,9 +4,7 @@ import view = require("ui/core/view"); import observable = require("data/observable"); import trace = require("trace"); -// merge the exports of the request file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class UIGestureRecognizerImpl extends NSObject { static new(): UIGestureRecognizerImpl { diff --git a/ui/html-view/html-view.android.ts b/ui/html-view/html-view.android.ts index 7dd20216d..fdca0da27 100644 --- a/ui/html-view/html-view.android.ts +++ b/ui/html-view/html-view.android.ts @@ -19,9 +19,7 @@ function onHtmlPropertyChanged(data: dependencyObservable.PropertyChangeData) { // register the setNativeValue callback (common.HtmlView.htmlProperty.metadata).onSetNativeValue = onHtmlPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class HtmlView extends common.HtmlView { private _android: android.widget.TextView; diff --git a/ui/html-view/html-view.ios.ts b/ui/html-view/html-view.ios.ts index 22a54a86e..02af1152a 100644 --- a/ui/html-view/html-view.ios.ts +++ b/ui/html-view/html-view.ios.ts @@ -24,9 +24,7 @@ function onHtmlPropertyChanged(data: dependencyObservable.PropertyChangeData) { // register the setNativeValue callback (common.HtmlView.htmlProperty.metadata).onSetNativeValue = onHtmlPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class HtmlView extends common.HtmlView { private _ios: UILabel; diff --git a/ui/image/image.android.ts b/ui/image/image.android.ts index b0c566d3d..6bb66de94 100644 --- a/ui/image/image.android.ts +++ b/ui/image/image.android.ts @@ -3,9 +3,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); import enums = require("ui/enums"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(imageCommon, exports); +global.moduleMerge(imageCommon, exports); function onStretchPropertyChanged(data: dependencyObservable.PropertyChangeData) { var image = data.object; diff --git a/ui/image/image.ios.ts b/ui/image/image.ios.ts index 159b1d701..c1a5f5cde 100644 --- a/ui/image/image.ios.ts +++ b/ui/image/image.ios.ts @@ -4,9 +4,7 @@ import proxy = require("ui/core/proxy"); import definition = require("ui/image"); import enums = require("ui/enums"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(imageCommon, exports); +global.moduleMerge(imageCommon, exports); function onStretchPropertyChanged(data: dependencyObservable.PropertyChangeData) { var image = data.object; diff --git a/ui/label/label.android.ts b/ui/label/label.android.ts index e2ead08c5..d44ef74f0 100644 --- a/ui/label/label.android.ts +++ b/ui/label/label.android.ts @@ -21,9 +21,7 @@ function onTextWrapPropertyChanged(data: dependencyObservable.PropertyChangeData // register the setNativeValue callback (common.Label.textWrapProperty.metadata).onSetNativeValue = onTextWrapPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Label extends common.Label { private _android: android.widget.TextView; diff --git a/ui/label/label.ios.ts b/ui/label/label.ios.ts index f3a0192d9..b65cd831b 100644 --- a/ui/label/label.ios.ts +++ b/ui/label/label.ios.ts @@ -22,9 +22,7 @@ function onTextWrapPropertyChanged(data: dependencyObservable.PropertyChangeData // register the setNativeValue callback (common.Label.textWrapProperty.metadata).onSetNativeValue = onTextWrapPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Label extends common.Label { private _ios: UILabel; diff --git a/ui/list-picker/list-picker.android.ts b/ui/list-picker/list-picker.android.ts index 1bf10eee5..87221d5f2 100644 --- a/ui/list-picker/list-picker.android.ts +++ b/ui/list-picker/list-picker.android.ts @@ -2,9 +2,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import types = require("utils/types"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ListPicker extends common.ListPicker { private _android: android.widget.NumberPicker; diff --git a/ui/list-picker/list-picker.ios.ts b/ui/list-picker/list-picker.ios.ts index 31803628f..2a27fac07 100644 --- a/ui/list-picker/list-picker.ios.ts +++ b/ui/list-picker/list-picker.ios.ts @@ -2,9 +2,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import types = require("utils/types"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ListPicker extends common.ListPicker { private _ios: UIPickerView; diff --git a/ui/list-view/list-view.android.ts b/ui/list-view/list-view.android.ts index d98231ea6..ab817c6d3 100644 --- a/ui/list-view/list-view.android.ts +++ b/ui/list-view/list-view.android.ts @@ -13,9 +13,7 @@ var LOADMOREITEMS = common.ListView.loadMoreItemsEvent; var ITEMTAP = common.ListView.itemTapEvent; var REALIZED_INDEX = "realizedIndex"; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); function onSeparatorColorPropertyChanged(data: dependencyObservable.PropertyChangeData) { var bar = data.object; diff --git a/ui/list-view/list-view.ios.ts b/ui/list-view/list-view.ios.ts index 0473e6d99..71a778e3f 100644 --- a/ui/list-view/list-view.ios.ts +++ b/ui/list-view/list-view.ios.ts @@ -13,9 +13,7 @@ var LOADMOREITEMS = common.ListView.loadMoreItemsEvent; var ITEMTAP = common.ListView.itemTapEvent; var DEFAULT_HEIGHT = 80; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); var infinity = utils.layout.makeMeasureSpec(0, utils.layout.UNSPECIFIED); diff --git a/ui/page/page.android.ts b/ui/page/page.android.ts index ef661979f..4c5db1662 100644 --- a/ui/page/page.android.ts +++ b/ui/page/page.android.ts @@ -3,8 +3,7 @@ import definition = require("ui/page"); import trace = require("trace"); import color = require("color"); -declare var exports; -require("utils/module-merge").merge(pageCommon, exports); +global.moduleMerge(pageCommon, exports); class DialogFragmentClass extends android.app.DialogFragment { private _owner: Page; diff --git a/ui/page/page.ios.ts b/ui/page/page.ios.ts index 51139e2d3..f79348e85 100644 --- a/ui/page/page.ios.ts +++ b/ui/page/page.ios.ts @@ -5,8 +5,7 @@ import trace = require("trace"); import utils = require("utils/utils"); import types = require("utils/types"); -declare var exports; -require("utils/module-merge").merge(pageCommon, exports); +global.moduleMerge(pageCommon, exports); class UIViewControllerImpl extends UIViewController { static new(): UIViewControllerImpl { diff --git a/ui/placeholder/placeholder.android.ts b/ui/placeholder/placeholder.android.ts index a8199de32..86359c443 100644 --- a/ui/placeholder/placeholder.android.ts +++ b/ui/placeholder/placeholder.android.ts @@ -1,9 +1,7 @@ import definition = require("ui/placeholder"); import common = require("ui/placeholder/placeholder-common"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Placeholder extends common.Placeholder { private _android: android.view.View; diff --git a/ui/placeholder/placeholder.ios.ts b/ui/placeholder/placeholder.ios.ts index 91d8f47cc..76e3a1e8b 100644 --- a/ui/placeholder/placeholder.ios.ts +++ b/ui/placeholder/placeholder.ios.ts @@ -1,9 +1,7 @@ import definition = require("ui/placeholder"); import common = require("ui/placeholder/placeholder-common"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Placeholder extends common.Placeholder { private _ios: UIView; diff --git a/ui/progress/progress.android.ts b/ui/progress/progress.android.ts index 870eec736..766c56beb 100644 --- a/ui/progress/progress.android.ts +++ b/ui/progress/progress.android.ts @@ -24,9 +24,7 @@ function onMaxValuePropertyChanged(data: dependencyObservable.PropertyChangeData (common.Progress.valueProperty.metadata).onSetNativeValue = onValuePropertyChanged; (common.Progress.maxValueProperty.metadata).onSetNativeValue = onMaxValuePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Progress extends common.Progress { private _android: android.widget.ProgressBar; diff --git a/ui/progress/progress.ios.ts b/ui/progress/progress.ios.ts index c8ffca413..2c414070d 100644 --- a/ui/progress/progress.ios.ts +++ b/ui/progress/progress.ios.ts @@ -16,9 +16,7 @@ function onMaxValuePropertyChanged(data: dependencyObservable.PropertyChangeData (common.Progress.valueProperty.metadata).onSetNativeValue = onValuePropertyChanged; (common.Progress.maxValueProperty.metadata).onSetNativeValue = onMaxValuePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Progress extends common.Progress { private _ios: UIProgressView; diff --git a/ui/scroll-view/scroll-view.android.ts b/ui/scroll-view/scroll-view.android.ts index 5bf20a774..4cf4a887d 100644 --- a/ui/scroll-view/scroll-view.android.ts +++ b/ui/scroll-view/scroll-view.android.ts @@ -6,9 +6,7 @@ import common = require("ui/scroll-view/scroll-view-common"); import utils = require("utils/utils"); import enums = require("ui/enums"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); var OWNER = "_owner"; var STATE = "_scrollViewState"; diff --git a/ui/scroll-view/scroll-view.ios.ts b/ui/scroll-view/scroll-view.ios.ts index a6653370b..8ea33a709 100644 --- a/ui/scroll-view/scroll-view.ios.ts +++ b/ui/scroll-view/scroll-view.ios.ts @@ -5,9 +5,7 @@ import common = require("ui/scroll-view/scroll-view-common"); import enums = require("ui/enums"); import utils = require("utils/utils"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class ScrollView extends contentView.ContentView implements definition.ScrollView { private _scroll: UIScrollView; diff --git a/ui/search-bar/search-bar.android.ts b/ui/search-bar/search-bar.android.ts index 9383391f9..2a05b0e83 100644 --- a/ui/search-bar/search-bar.android.ts +++ b/ui/search-bar/search-bar.android.ts @@ -90,9 +90,7 @@ function _changeSearchViewHintColor(bar: android.widget.SearchView, color: numbe } } -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class SearchBar extends common.SearchBar { private _android: android.widget.SearchView; diff --git a/ui/search-bar/search-bar.ios.ts b/ui/search-bar/search-bar.ios.ts index 20d633533..b43a3e406 100644 --- a/ui/search-bar/search-bar.ios.ts +++ b/ui/search-bar/search-bar.ios.ts @@ -60,9 +60,7 @@ function getUITextField(bar: UISearchBar): UITextField { return undefined; } -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class UISearchBarDelegateImpl extends NSObject implements UISearchBarDelegate { public static ObjCProtocols = [UISearchBarDelegate]; diff --git a/ui/segmented-bar/segmented-bar.android.ts b/ui/segmented-bar/segmented-bar.android.ts index 98b616e35..c76a2f372 100644 --- a/ui/segmented-bar/segmented-bar.android.ts +++ b/ui/segmented-bar/segmented-bar.android.ts @@ -4,9 +4,7 @@ import dependencyObservable = require("ui/core/dependency-observable"); import proxy = require("ui/core/proxy"); import types = require("utils/types"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); function onSelectedIndexPropertyChanged(data: dependencyObservable.PropertyChangeData) { var view = data.object; diff --git a/ui/segmented-bar/segmented-bar.ios.ts b/ui/segmented-bar/segmented-bar.ios.ts index efc8eeb2f..d5adeee19 100644 --- a/ui/segmented-bar/segmented-bar.ios.ts +++ b/ui/segmented-bar/segmented-bar.ios.ts @@ -5,9 +5,7 @@ import proxy = require("ui/core/proxy"); import types = require("utils/types"); import color = require("color"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); function onSelectedIndexPropertyChanged(data: dependencyObservable.PropertyChangeData) { var view = data.object; diff --git a/ui/slider/slider.android.ts b/ui/slider/slider.android.ts index 6d22da378..60fd1fa33 100644 --- a/ui/slider/slider.android.ts +++ b/ui/slider/slider.android.ts @@ -35,9 +35,7 @@ function onMaxValuePropertyChanged(data: dependencyObservable.PropertyChangeData (common.Slider.minValueProperty.metadata).onSetNativeValue = onMinValuePropertyChanged; (common.Slider.maxValueProperty.metadata).onSetNativeValue = onMaxValuePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Slider extends common.Slider { private _supressNativeValue: boolean; diff --git a/ui/slider/slider.ios.ts b/ui/slider/slider.ios.ts index 672f1f7f9..530e49f22 100644 --- a/ui/slider/slider.ios.ts +++ b/ui/slider/slider.ios.ts @@ -22,9 +22,7 @@ function onMaxValuePropertyChanged(data: dependencyObservable.PropertyChangeData (common.Slider.minValueProperty.metadata).onSetNativeValue = onMinValuePropertyChanged; (common.Slider.maxValueProperty.metadata).onSetNativeValue = onMaxValuePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class SliderChangeHandlerImpl extends NSObject { static new(): SliderChangeHandlerImpl { diff --git a/ui/styling/background.android.ts b/ui/styling/background.android.ts index 6c4a2f3f2..8ca7dc622 100644 --- a/ui/styling/background.android.ts +++ b/ui/styling/background.android.ts @@ -2,8 +2,7 @@ import utils = require("utils/utils"); import common = require("ui/styling/background-common"); import dts = require("ui/styling/background"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); // We are using "ad" here to avoid namespace collision with the global android object export module ad { diff --git a/ui/styling/background.ios.ts b/ui/styling/background.ios.ts index ec3e59fa2..6203186ef 100644 --- a/ui/styling/background.ios.ts +++ b/ui/styling/background.ios.ts @@ -2,8 +2,7 @@ import viewModule = require("ui/core/view"); import style = require("ui/styling/style"); import common = require("ui/styling/background-common"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export module ios { export function createBackgroundUIColor(view: viewModule.View): UIColor { diff --git a/ui/styling/stylers.android.ts b/ui/styling/stylers.android.ts index d68897d51..fd1849f78 100644 --- a/ui/styling/stylers.android.ts +++ b/ui/styling/stylers.android.ts @@ -10,9 +10,7 @@ import styleModule = require("ui/styling/style"); import font = require("ui/styling/font"); import background = require("ui/styling/background"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(stylersCommon, exports); +global.moduleMerge(stylersCommon, exports); var _defaultBackgrounds = new Map(); function onBackgroundOrBorderPropertyChanged(v: view.View) { diff --git a/ui/styling/stylers.ios.ts b/ui/styling/stylers.ios.ts index 14ec84d2c..e7c66fd26 100644 --- a/ui/styling/stylers.ios.ts +++ b/ui/styling/stylers.ios.ts @@ -6,9 +6,7 @@ import enums = require("ui/enums"); import font = require("ui/styling/font"); import background = require("ui/styling/background"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(stylersCommon, exports); +global.moduleMerge(stylersCommon, exports); interface TextUIView { font: UIFont; diff --git a/ui/switch/switch.android.ts b/ui/switch/switch.android.ts index 8763fe978..4363c6acf 100644 --- a/ui/switch/switch.android.ts +++ b/ui/switch/switch.android.ts @@ -14,9 +14,7 @@ function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData) // register the setNativeValue callbacks (common.Switch.checkedProperty.metadata).onSetNativeValue = onCheckedPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class Switch extends common.Switch { private _android: android.widget.Switch; diff --git a/ui/switch/switch.ios.ts b/ui/switch/switch.ios.ts index 43dec3f1a..0c0acc6c5 100644 --- a/ui/switch/switch.ios.ts +++ b/ui/switch/switch.ios.ts @@ -10,9 +10,7 @@ function onCheckedPropertyChanged(data: dependencyObservable.PropertyChangeData) // register the setNativeValue callbacks (common.Switch.checkedProperty.metadata).onSetNativeValue = onCheckedPropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class SwitchChangeHandlerImpl extends NSObject { static new(): SwitchChangeHandlerImpl { diff --git a/ui/tab-view/tab-view.android.ts b/ui/tab-view/tab-view.android.ts index e289b34a0..44ddb7067 100644 --- a/ui/tab-view/tab-view.android.ts +++ b/ui/tab-view/tab-view.android.ts @@ -11,9 +11,7 @@ import page = require("ui/page"); var VIEWS_STATES = "_viewStates"; var RESOURCE_PREFIX = "res://"; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class ViewPagerClass extends android.support.v4.view.ViewPager { private owner: TabView; diff --git a/ui/tab-view/tab-view.ios.ts b/ui/tab-view/tab-view.ios.ts index a84c8d91a..e0201fc4c 100644 --- a/ui/tab-view/tab-view.ios.ts +++ b/ui/tab-view/tab-view.ios.ts @@ -8,9 +8,7 @@ import view = require("ui/core/view"); import imageSource = require("image-source"); import types = require("utils/types"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class UITabBarControllerImpl extends UITabBarController { static new(): UITabBarControllerImpl { diff --git a/ui/text-field/text-field-common.ts b/ui/text-field/text-field-common.ts index d71702ffd..78bedd172 100644 --- a/ui/text-field/text-field-common.ts +++ b/ui/text-field/text-field-common.ts @@ -10,9 +10,7 @@ export var secureProperty = new dependencyObservable.Property( new proxy.PropertyMetadata(false) ); -// merge the exports of the textBase file with the exports of this file -declare var exports; -require("utils/module-merge").merge(textBase, exports); +global.moduleMerge(textBase, exports); export class TextField extends editableTextBase.EditableTextBase implements definition.TextField { constructor(options?: definition.Options) { diff --git a/ui/text-field/text-field.android.ts b/ui/text-field/text-field.android.ts index e2e0ddc0d..8dac6fb1c 100644 --- a/ui/text-field/text-field.android.ts +++ b/ui/text-field/text-field.android.ts @@ -40,9 +40,7 @@ function onSecurePropertyChanged(data: dependencyObservable.PropertyChangeData) // register the setNativeValue callbacks (common.secureProperty.metadata).onSetNativeValue = onSecurePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class TextField extends common.TextField { public _configureEditText() { diff --git a/ui/text-field/text-field.ios.ts b/ui/text-field/text-field.ios.ts index 2397f561c..ecdcea5a4 100644 --- a/ui/text-field/text-field.ios.ts +++ b/ui/text-field/text-field.ios.ts @@ -11,9 +11,7 @@ function onSecurePropertyChanged(data: dependencyObservable.PropertyChangeData) (common.secureProperty.metadata).onSetNativeValue = onSecurePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate { public static ObjCProtocols = [UITextFieldDelegate]; diff --git a/ui/text-view/text-view-common.ts b/ui/text-view/text-view-common.ts index 8a2780037..4e6567f95 100644 --- a/ui/text-view/text-view-common.ts +++ b/ui/text-view/text-view-common.ts @@ -2,9 +2,7 @@ import textBase = require("ui/text-base"); import editableTextBase = require("ui/editable-text-base"); -// merge the exports of the textBase file with the exports of this file -declare var exports; -require("utils/module-merge").merge(textBase, exports); +global.moduleMerge(textBase, exports); export class TextView extends editableTextBase.EditableTextBase implements definition.TextView { constructor(options?: editableTextBase.Options) { diff --git a/ui/text-view/text-view.android.ts b/ui/text-view/text-view.android.ts index d5aee2464..e0a06f3c1 100644 --- a/ui/text-view/text-view.android.ts +++ b/ui/text-view/text-view.android.ts @@ -1,8 +1,6 @@ import common = require("ui/text-view/text-view-common"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class TextView extends common.TextView { public _configureEditText() { diff --git a/ui/time-picker/time-picker.android.ts b/ui/time-picker/time-picker.android.ts index f7268887d..d966c6b30 100644 --- a/ui/time-picker/time-picker.android.ts +++ b/ui/time-picker/time-picker.android.ts @@ -16,9 +16,7 @@ function onMinutePropertyChanged(data: dependencyObservable.PropertyChangeData) (common.TimePicker.minuteProperty.metadata).onSetNativeValue = onMinutePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class TimePicker extends common.TimePicker { private _android: android.widget.TimePicker; diff --git a/ui/time-picker/time-picker.ios.ts b/ui/time-picker/time-picker.ios.ts index 49d45afa4..72c257bbf 100644 --- a/ui/time-picker/time-picker.ios.ts +++ b/ui/time-picker/time-picker.ios.ts @@ -26,9 +26,7 @@ function onMinutePropertyChanged(data: dependencyObservable.PropertyChangeData) (common.TimePicker.minuteProperty.metadata).onSetNativeValue = onMinutePropertyChanged; -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export class TimePicker extends common.TimePicker { private _ios: UIDatePicker; diff --git a/ui/web-view/web-view.android.ts b/ui/web-view/web-view.android.ts index a864ea081..13dc09095 100644 --- a/ui/web-view/web-view.android.ts +++ b/ui/web-view/web-view.android.ts @@ -3,8 +3,7 @@ import trace = require("trace"); import utils = require("utils/utils"); import fs = require("file-system"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class WebViewClientClass extends android.webkit.WebViewClient { private _view: common.WebView; diff --git a/ui/web-view/web-view.ios.ts b/ui/web-view/web-view.ios.ts index edee9ce0a..053857442 100644 --- a/ui/web-view/web-view.ios.ts +++ b/ui/web-view/web-view.ios.ts @@ -3,8 +3,7 @@ import trace = require("trace"); import utils = require("utils/utils"); import fs = require("file-system"); -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); class UIWebViewDelegateImpl extends NSObject implements UIWebViewDelegate { public static ObjCProtocols = [UIWebViewDelegate]; diff --git a/utils/utils.android.ts b/utils/utils.android.ts index 542830e30..a1e086ee9 100644 --- a/utils/utils.android.ts +++ b/utils/utils.android.ts @@ -1,8 +1,6 @@ import common = require("utils/utils-common"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); export module layout { var density = -1; diff --git a/utils/utils.ios.ts b/utils/utils.ios.ts index 1e764aa34..e479ffa07 100644 --- a/utils/utils.ios.ts +++ b/utils/utils.ios.ts @@ -1,11 +1,8 @@ import common = require("utils/utils-common"); import colorModule = require("color"); import view = require("ui/core/view"); -//import trace = require("trace"); -// merge the exports of the common file with the exports of this file -declare var exports; -require("utils/module-merge").merge(common, exports); +global.moduleMerge(common, exports); function isOrientationLandscape(orientation: number) { return orientation === UIDeviceOrientation.UIDeviceOrientationLandscapeLeft || orientation === UIDeviceOrientation.UIDeviceOrientationLandscapeRight;