diff --git a/ui/core/bindable.ts b/ui/core/bindable.ts index d2d0727e4..5c7cd524f 100644 --- a/ui/core/bindable.ts +++ b/ui/core/bindable.ts @@ -2,13 +2,22 @@ import definition = require("ui/core/bindable"); import dependencyObservable = require("ui/core/dependency-observable"); import weakEvents = require("ui/core/weak-event-listener"); -import appModule = require("application"); import types = require("utils/types"); import trace = require("trace"); import polymerExpressions = require("js-libs/polymer-expressions"); import bindingBuilder = require("../builder/binding-builder"); import viewModule = require("ui/core/view"); +//late import +var _appModule = null; + +function appModule() { + if (!_appModule) { + _appModule = require("application"); + } + return _appModule; +} + var bindingContextProperty = new dependencyObservable.Property( "bindingContext", "Bindable", @@ -359,9 +368,9 @@ export class Binding { if (exp) { var context = this.source && this.source.get && this.source.get() || global; var model = {}; - for (var prop in appModule.resources) { - if (appModule.resources.hasOwnProperty(prop) && !context.hasOwnProperty(prop)) { - context[prop] = appModule.resources[prop]; + for (var prop in appModule().resources) { + if (appModule().resources.hasOwnProperty(prop) && !context.hasOwnProperty(prop)) { + context[prop] = appModule().resources[prop]; } } @@ -595,4 +604,4 @@ export class Binding { this.updating = false; } -} \ No newline at end of file +} diff --git a/ui/styling/stylers-common.ts b/ui/styling/stylers-common.ts index 257a2827b..8331d69db 100644 --- a/ui/styling/stylers-common.ts +++ b/ui/styling/stylers-common.ts @@ -1,8 +1,17 @@ import view = require("ui/core/view"); -import application = require("application"); import dependencyObservable = require("ui/core/dependency-observable"); import types = require("utils/types"); +//late import +var _appModule = null; + +function appModule() { + if (!_appModule) { + _appModule = require("application"); + } + return _appModule; +} + var _defaultNativeValuesCache = {}; export class StylePropertyChangedHandler { @@ -26,10 +35,9 @@ export class StylePropertyChangedHandler { _defaultNativeValuesCache[className + property.id] = this._getNativeValue(view); } - if (application.android) { + if (appModule().android) { newValue = newValue.android ? newValue.android : newValue; - } - else if (application.ios) { + } else if (appModule().ios) { newValue = newValue.ios ? newValue.ios : newValue; } @@ -40,4 +48,4 @@ export class StylePropertyChangedHandler { var className = types.getClass(view); this._resetProperty(view, _defaultNativeValuesCache[className + property.id]); } -} \ No newline at end of file +}