sproutcore 1.11.0.rc1 → 1.11.0.rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +93 -65
- data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +17 -7
- data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +22 -2
- data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +14 -0
- data/lib/frameworks/sproutcore/apps/showcase/resources/views_page.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +20 -8
- data/lib/frameworks/sproutcore/frameworks/ajax/system/websocket.js +58 -43
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/action_support.js +192 -35
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/delegate_support.js +7 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +27 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +20 -63
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/color.js +16 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +279 -159
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +21 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/action_support.js +32 -28
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/targetForAction.js +107 -90
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/root_responder/touch.js +33 -25
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/touch.js +23 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +12 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +55 -33
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +7 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +228 -72
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/touch.js +54 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +57 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +9 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll_view.js +111 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +51 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +13 -10
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +28 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +51 -46
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +8 -5
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +12 -3
- metadata +2 -2
@@ -56,7 +56,7 @@ SC.DRAG_REORDER = 0x0010;
|
|
56
56
|
@extends SC.CollectionContent
|
57
57
|
@since SproutCore 0.9
|
58
58
|
*/
|
59
|
-
SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionContent,
|
59
|
+
SC.CollectionView = SC.View.extend(SC.ActionSupport, SC.CollectionViewDelegate, SC.CollectionContent,
|
60
60
|
/** @scope SC.CollectionView.prototype */ {
|
61
61
|
|
62
62
|
/** @private */
|
@@ -472,13 +472,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
472
472
|
If you do not specify an action, then the collection view will also try to
|
473
473
|
invoke the action named on the target item view.
|
474
474
|
|
475
|
-
Older versions of SproutCore expected the action property to contain an
|
476
|
-
actual function that would be run. This format is still supported but is
|
477
|
-
deprecated for future use. You should generally use the responder chain
|
478
|
-
to handle your action for you.
|
479
|
-
|
480
475
|
@type String
|
481
476
|
@default null
|
477
|
+
@see SC.ActionSupport
|
482
478
|
*/
|
483
479
|
action: null,
|
484
480
|
|
@@ -490,9 +486,6 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
490
486
|
This can be either an actual object or a property path that will resolve
|
491
487
|
to an object at the time that the action is invoked.
|
492
488
|
|
493
|
-
This property is ignored if you use the deprecated approach of making the
|
494
|
-
action property a function.
|
495
|
-
|
496
489
|
@type String|Object
|
497
490
|
@default null
|
498
491
|
*/
|
@@ -3240,17 +3233,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3240
3233
|
*/
|
3241
3234
|
_cv_action: function(view, evt, context) {
|
3242
3235
|
var action = this.get('action');
|
3243
|
-
var target = this.get('target') || null;
|
3244
3236
|
|
3245
3237
|
this._cv_actionTimer = null;
|
3246
3238
|
if (action) {
|
3247
|
-
// if the action is a function, just call it
|
3248
|
-
if (SC.typeOf(action) === SC.T_FUNCTION) return this.action(view, evt) ;
|
3249
3239
|
|
3250
|
-
//
|
3251
|
-
|
3252
|
-
|
3253
|
-
|
3240
|
+
// Legacy support for action functions.
|
3241
|
+
if (action && (SC.typeOf(action) === SC.T_FUNCTION)) {
|
3242
|
+
return this.action(view, evt);
|
3243
|
+
|
3244
|
+
// Use SC.ActionSupport.
|
3245
|
+
} else {
|
3246
|
+
return this.fireAction(context);
|
3254
3247
|
}
|
3255
3248
|
|
3256
3249
|
// if no action is specified, then trigger the support action,
|
@@ -187,10 +187,10 @@ SC.ScrollView = SC.View.extend({
|
|
187
187
|
_sc_scale: null,
|
188
188
|
|
189
189
|
/** @private Flag used to indicate when we should resize the content width manually. */
|
190
|
-
_sc_shouldResizeContentWidth: false,
|
190
|
+
// _sc_shouldResizeContentWidth: false,
|
191
191
|
|
192
192
|
/** @private Flag used to indicate when we should resize the content height manually. */
|
193
|
-
_sc_shouldResizeContentHeight: false,
|
193
|
+
// _sc_shouldResizeContentHeight: false,
|
194
194
|
|
195
195
|
/** @private The offset center x of a multi-touch gesture. */
|
196
196
|
_sc_touchCenterX: null,
|
@@ -944,27 +944,34 @@ SC.ScrollView = SC.View.extend({
|
|
944
944
|
_sc_containerViewFrameDidChange: function () {
|
945
945
|
// Run the content view size change code (updates min & max offsets, sets content alignment if necessary, shows scrollers if necessary)
|
946
946
|
var containerFrame = this.getPath('containerView.frame'),
|
947
|
-
contentView = this.get('contentView')
|
947
|
+
contentView = this.get('contentView'),
|
948
|
+
lastMaximumHorizontalScrollOffset = this.get('maximumHorizontalScrollOffset'),
|
949
|
+
lastMaximumVerticalScrollOffset = this.get('maximumVerticalScrollOffset'),
|
950
|
+
lastMinimumHorizontalScrollOffset = this.get('minimumHorizontalScrollOffset'),
|
951
|
+
lastMinimumVerticalScrollOffset = this.get('minimumVerticalScrollOffset');
|
948
952
|
|
949
953
|
// Cache the current height and width of the container view, so we can only watch for size changes.
|
954
|
+
// This will update the maximum scroll offsets when they are requested.
|
950
955
|
this.set('_sc_containerHeight', containerFrame.height);
|
951
956
|
this.set('_sc_containerWidth', containerFrame.width);
|
952
957
|
|
953
958
|
if (contentView) {
|
954
|
-
var didAdjust = false;
|
959
|
+
// var didAdjust = false;
|
955
960
|
|
956
|
-
if (this._sc_shouldResizeContentHeight) {
|
957
|
-
|
958
|
-
|
959
|
-
}
|
961
|
+
// if (this._sc_shouldResizeContentHeight) {
|
962
|
+
// contentView.adjust('height', containerFrame.height);
|
963
|
+
// didAdjust = true;
|
964
|
+
// }
|
960
965
|
|
961
|
-
if (this._sc_shouldResizeContentWidth) {
|
962
|
-
|
963
|
-
|
964
|
-
}
|
966
|
+
// if (this._sc_shouldResizeContentWidth) {
|
967
|
+
// contentView.adjust('width', containerFrame.width);
|
968
|
+
// didAdjust = true;
|
969
|
+
// }
|
965
970
|
|
966
971
|
// Update the scrollers regardless.
|
967
|
-
if (!didAdjust) {
|
972
|
+
// if (!didAdjust) {
|
973
|
+
this._sc_contentViewSizeDidChange(lastMinimumHorizontalScrollOffset, lastMaximumHorizontalScrollOffset, lastMinimumVerticalScrollOffset, lastMaximumVerticalScrollOffset);
|
974
|
+
// }
|
968
975
|
}
|
969
976
|
|
970
977
|
},
|
@@ -979,8 +986,8 @@ SC.ScrollView = SC.View.extend({
|
|
979
986
|
this._sc_removeContentViewObservers();
|
980
987
|
|
981
988
|
// Reset caches.
|
982
|
-
this._sc_shouldResizeContentWidth = false;
|
983
|
-
this._sc_shouldResizeContentHeight = false;
|
989
|
+
// this._sc_shouldResizeContentWidth = false;
|
990
|
+
// this._sc_shouldResizeContentHeight = false;
|
984
991
|
this._sc_contentHeight = 0;
|
985
992
|
this._sc_contentWidth = 0;
|
986
993
|
this._sc_contentScale = 1;
|
@@ -1004,29 +1011,29 @@ SC.ScrollView = SC.View.extend({
|
|
1004
1011
|
|
1005
1012
|
// When a view wants an accelerated layer and isn't a fixed size, we convert it to a fixed
|
1006
1013
|
// size and resize it when our container resizes.
|
1007
|
-
if (!newView.get('isFixedSize')) {
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
}
|
1014
|
+
// if (newView.get('wantsAcceleratedLayer') && !newView.get('isFixedSize')) {
|
1015
|
+
// var contentViewLayout = newView.get('layout');
|
1016
|
+
|
1017
|
+
// // Fix the width.
|
1018
|
+
// if (contentViewLayout.width == null) {
|
1019
|
+
// this._sc_shouldResizeContentWidth = true; // Flag to indicate that when the container's width changes, we should update the content's width.
|
1020
|
+
|
1021
|
+
// newView.adjust({
|
1022
|
+
// right: null,
|
1023
|
+
// width: this._sc_containerWidth
|
1024
|
+
// });
|
1025
|
+
// }
|
1026
|
+
|
1027
|
+
// // Fix the height.
|
1028
|
+
// if (contentViewLayout.height == null) {
|
1029
|
+
// this._sc_shouldResizeContentHeight = true; // Flag to indicate that when the container's height changes, we should update the content's height.
|
1030
|
+
|
1031
|
+
// newView.adjust({
|
1032
|
+
// bottom: null,
|
1033
|
+
// height: this._sc_containerHeight
|
1034
|
+
// });
|
1035
|
+
// }
|
1036
|
+
// }
|
1030
1037
|
}
|
1031
1038
|
|
1032
1039
|
// TODO: Can we remove this if a calculated property exists?
|
@@ -1050,7 +1057,11 @@ SC.ScrollView = SC.View.extend({
|
|
1050
1057
|
var lastHeight = this._sc_contentHeight,
|
1051
1058
|
lastScale = this._sc_contentScale,
|
1052
1059
|
lastWidth = this._sc_contentWidth,
|
1053
|
-
newFrame = this.getPath('contentView.borderFrame')
|
1060
|
+
newFrame = this.getPath('contentView.borderFrame'),
|
1061
|
+
lastMaximumHorizontalScrollOffset = this.get('maximumHorizontalScrollOffset'),
|
1062
|
+
lastMaximumVerticalScrollOffset = this.get('maximumVerticalScrollOffset'),
|
1063
|
+
lastMinimumHorizontalScrollOffset = this.get('minimumHorizontalScrollOffset'),
|
1064
|
+
lastMinimumVerticalScrollOffset = this.get('minimumVerticalScrollOffset');
|
1054
1065
|
|
1055
1066
|
if (newFrame) {
|
1056
1067
|
// Determine whether the scale has changed.
|
@@ -1071,14 +1082,13 @@ SC.ScrollView = SC.View.extend({
|
|
1071
1082
|
|
1072
1083
|
// If any of the size values changed, update.
|
1073
1084
|
if (this._sc_contentScaleDidChange || this._sc_contentWidthDidChange || this._sc_contentHeightDidChange) {
|
1074
|
-
|
1075
|
-
this.invokeOnce(this._sc_contentViewSizeDidChange);
|
1085
|
+
this._sc_contentViewSizeDidChange(lastMinimumHorizontalScrollOffset, lastMaximumHorizontalScrollOffset, lastMinimumVerticalScrollOffset, lastMaximumVerticalScrollOffset);
|
1076
1086
|
}
|
1077
1087
|
}
|
1078
1088
|
},
|
1079
1089
|
|
1080
1090
|
/** @private When the content view's size changes, we need to update our scroll offset properties. */
|
1081
|
-
_sc_contentViewSizeDidChange: function () {
|
1091
|
+
_sc_contentViewSizeDidChange: function (lastMinimumHorizontalScrollOffset, lastMaximumHorizontalScrollOffset, lastMinimumVerticalScrollOffset, lastMaximumVerticalScrollOffset) {
|
1082
1092
|
var maximumHorizontalScrollOffset = this.get('maximumHorizontalScrollOffset'),
|
1083
1093
|
maximumVerticalScrollOffset = this.get('maximumVerticalScrollOffset'),
|
1084
1094
|
containerHeight, containerWidth,
|
@@ -1116,6 +1126,35 @@ SC.ScrollView = SC.View.extend({
|
|
1116
1126
|
if (this._sc_gestureAnchorHOffset != null) {
|
1117
1127
|
this._sc_gestureAnchorHOffset = value;
|
1118
1128
|
}
|
1129
|
+
} else {
|
1130
|
+
// Take alignment into account.
|
1131
|
+
var horizontalAlign = this.get('horizontalAlign'),
|
1132
|
+
horizontalScrollOffset = this._sc_horizontalScrollOffset,
|
1133
|
+
minimumHorizontalScrollOffset = this.get('minimumHorizontalScrollOffset');
|
1134
|
+
|
1135
|
+
switch (horizontalAlign) {
|
1136
|
+
case SC.ALIGN_CENTER:
|
1137
|
+
// Switched to scrolling horizontally, stick to center OR was scrolled at center and size changed.
|
1138
|
+
if ((lastMinimumHorizontalScrollOffset < 0 && minimumHorizontalScrollOffset === 0) ||
|
1139
|
+
(horizontalScrollOffset === lastMaximumHorizontalScrollOffset / 2)) {
|
1140
|
+
this.set('horizontalScrollOffset', maximumHorizontalScrollOffset / 2);
|
1141
|
+
}
|
1142
|
+
|
1143
|
+
break;
|
1144
|
+
case SC.ALIGN_RIGHT:
|
1145
|
+
// Switched to scrolling horizontally, stick to right side OR was scrolled to right and size changed.
|
1146
|
+
if ((lastMinimumHorizontalScrollOffset < 0 && minimumHorizontalScrollOffset === 0) ||
|
1147
|
+
(horizontalScrollOffset === lastMaximumHorizontalScrollOffset)) {
|
1148
|
+
this.set('horizontalScrollOffset', maximumHorizontalScrollOffset);
|
1149
|
+
}
|
1150
|
+
|
1151
|
+
break;
|
1152
|
+
}
|
1153
|
+
|
1154
|
+
// Was at right side and size shrunk.
|
1155
|
+
if (horizontalScrollOffset > maximumHorizontalScrollOffset) {
|
1156
|
+
this.set('horizontalScrollOffset', maximumHorizontalScrollOffset);
|
1157
|
+
}
|
1119
1158
|
}
|
1120
1159
|
}
|
1121
1160
|
}
|
@@ -1146,6 +1185,34 @@ SC.ScrollView = SC.View.extend({
|
|
1146
1185
|
if (this._sc_gestureAnchorVOffset != null) {
|
1147
1186
|
this._sc_gestureAnchorVOffset = value;
|
1148
1187
|
}
|
1188
|
+
} else {
|
1189
|
+
var verticalAlign = this.get('verticalAlign'),
|
1190
|
+
verticalScrollOffset = this._sc_verticalScrollOffset,
|
1191
|
+
minimumVerticalScrollOffset = this.get('minimumVerticalScrollOffset');
|
1192
|
+
|
1193
|
+
switch (verticalAlign) {
|
1194
|
+
case SC.ALIGN_MIDDLE:
|
1195
|
+
// Switched to scrolling vertically, stick to middle OR was scrolled at middle and size changed.
|
1196
|
+
if ((lastMinimumVerticalScrollOffset < 0 && minimumVerticalScrollOffset === 0) ||
|
1197
|
+
(verticalScrollOffset === lastMaximumVerticalScrollOffset / 2)) {
|
1198
|
+
this.set('verticalScrollOffset', maximumVerticalScrollOffset / 2);
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
break;
|
1202
|
+
case SC.ALIGN_BOTTOM:
|
1203
|
+
// Switched to scrolling vertically, stick to bottom side OR was scrolled to bottom and size changed.
|
1204
|
+
if ((lastMinimumVerticalScrollOffset < 0 && minimumVerticalScrollOffset === 0) ||
|
1205
|
+
(verticalScrollOffset === lastMaximumVerticalScrollOffset)) {
|
1206
|
+
this.set('verticalScrollOffset', maximumVerticalScrollOffset);
|
1207
|
+
}
|
1208
|
+
|
1209
|
+
break;
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
// Was at bottom side and size shrunk.
|
1213
|
+
if (verticalScrollOffset > maximumVerticalScrollOffset) {
|
1214
|
+
this.set('verticalScrollOffset', maximumVerticalScrollOffset);
|
1215
|
+
}
|
1149
1216
|
}
|
1150
1217
|
}
|
1151
1218
|
}
|
@@ -1502,8 +1569,8 @@ SC.ScrollView = SC.View.extend({
|
|
1502
1569
|
oldView.removeObserver('frame', this, frameChangeFunc);
|
1503
1570
|
// oldView.removeObserver('layer', this, layerChangeFunc);
|
1504
1571
|
|
1505
|
-
this._sc_shouldResizeContentWidth = false;
|
1506
|
-
this._sc_shouldResizeContentHeight = false;
|
1572
|
+
// this._sc_shouldResizeContentWidth = false;
|
1573
|
+
// this._sc_shouldResizeContentHeight = false;
|
1507
1574
|
}
|
1508
1575
|
},
|
1509
1576
|
|
@@ -535,6 +535,8 @@ SC.SegmentedView = SC.View.extend(SC.Control,
|
|
535
535
|
Whenever the view resizes, we need to check to see if we're overflowing.
|
536
536
|
*/
|
537
537
|
viewDidResize: function () {
|
538
|
+
this._viewFrameDidChange();
|
539
|
+
|
538
540
|
var isHorizontal = this.get('layoutDirection') === SC.LAYOUT_HORIZONTAL,
|
539
541
|
visibleDim = isHorizontal ? this.$().width() : this.$().height();
|
540
542
|
|
@@ -8,7 +8,10 @@
|
|
8
8
|
/*globals jQuery */
|
9
9
|
|
10
10
|
sc_require('tasks/task');
|
11
|
+
|
12
|
+
//@if(debug)
|
11
13
|
SC.LOG_MODULE_LOADING = YES;
|
14
|
+
//@endif
|
12
15
|
|
13
16
|
/**
|
14
17
|
SC.Module is responsible for dynamically loading in JavaScript and other
|
@@ -51,10 +54,20 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
51
54
|
@returns {Boolean} YES if already loaded, NO otherwise
|
52
55
|
*/
|
53
56
|
loadModule: function (moduleName, target, method) {
|
54
|
-
var module = SC.MODULE_INFO[moduleName],
|
55
|
-
|
57
|
+
var module = SC.MODULE_INFO[moduleName],
|
58
|
+
//@if(debug)
|
56
59
|
log = SC.LOG_MODULE_LOADING,
|
57
|
-
|
60
|
+
//@endif
|
61
|
+
args;
|
62
|
+
|
63
|
+
if (arguments.length > 3) {
|
64
|
+
// Fast arguments access.
|
65
|
+
// Accessing `arguments.length` is just a Number and doesn't materialize the `arguments` object, which is costly.
|
66
|
+
args = new Array(arguments.length - 3); // SC.A(arguments).slice(3)
|
67
|
+
for (var i = 0, len = args.length; i < len; i++) { args[i] = arguments[i + 3]; }
|
68
|
+
} else {
|
69
|
+
args = [];
|
70
|
+
}
|
58
71
|
|
59
72
|
// Treat the first parameter as the callback if the target is a function and there is
|
60
73
|
// no method supplied.
|
@@ -63,7 +76,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
63
76
|
target = null;
|
64
77
|
}
|
65
78
|
|
79
|
+
//@if(debug)
|
66
80
|
if (log) SC.debug("SC.Module: Attempting to load '%@'", moduleName);
|
81
|
+
//@endif
|
67
82
|
|
68
83
|
// If we couldn't find anything in the SC.MODULE_INFO hash, we don't have any record of the
|
69
84
|
// requested module.
|
@@ -78,7 +93,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
78
93
|
// If the module is already loaded, execute the callback immediately if SproutCore is loaded,
|
79
94
|
// or else as soon as SC has finished loading.
|
80
95
|
if (module.isLoaded && !module.isWaitingForRunLoop) {
|
96
|
+
//@if(debug)
|
81
97
|
if (log) SC.debug("SC.Module: Module '%@' already loaded.", moduleName);
|
98
|
+
//@endif
|
82
99
|
|
83
100
|
// we can't just eval it if its dependencies have not been met...
|
84
101
|
if (!this._dependenciesMetForModule(moduleName)) {
|
@@ -94,7 +111,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
94
111
|
// If the module has finished loading and we have the string
|
95
112
|
// representation, try to evaluate it now.
|
96
113
|
if (module.source) {
|
114
|
+
//@if(debug)
|
97
115
|
if (log) SC.debug("SC.Module: Evaluating JavaScript for module '%@'.", moduleName);
|
116
|
+
//@endif
|
98
117
|
this._evaluateStringLoadedModule(module);
|
99
118
|
|
100
119
|
// we can't let it return normally here, because we need the module to wait until the end of the run loop.
|
@@ -131,7 +150,10 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
131
150
|
// The module is not yet loaded, so register the callback and, if necessary, begin loading
|
132
151
|
// the code.
|
133
152
|
else {
|
153
|
+
|
154
|
+
//@if(debug)
|
134
155
|
if (log) SC.debug("SC.Module: Module '%@' is not loaded, loading now.", moduleName);
|
156
|
+
//@endif
|
135
157
|
|
136
158
|
// If this method is called more than once for the same module before it is finished
|
137
159
|
// loading, we might have multiple callbacks that need to be executed once it loads.
|
@@ -392,7 +414,10 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
392
414
|
_loadDependenciesForModule: function (moduleName) {
|
393
415
|
// Load module's dependencies first.
|
394
416
|
var moduleInfo = SC.MODULE_INFO[moduleName];
|
417
|
+
|
418
|
+
//@if(debug)
|
395
419
|
var log = SC.LOG_MODULE_LOADING;
|
420
|
+
//@endif
|
396
421
|
var dependencies = moduleInfo.dependencies || [];
|
397
422
|
var dependenciesMet = YES;
|
398
423
|
var len = dependencies.length;
|
@@ -433,7 +458,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
433
458
|
|
434
459
|
dependents.push(moduleName);
|
435
460
|
|
461
|
+
//@if(debug)
|
436
462
|
if (log) SC.debug("SC.Module: '%@' depends on '%@', loading dependency…", moduleName, requiredModuleName);
|
463
|
+
//@endif
|
437
464
|
|
438
465
|
// Load dependencies
|
439
466
|
SC.Module.loadModule(requiredModuleName);
|
@@ -492,7 +519,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
492
519
|
var moduleInfo = SC.MODULE_INFO[moduleName], callbacks;
|
493
520
|
if (!moduleInfo) return; // shouldn't happen, but recover anyway
|
494
521
|
|
522
|
+
//@if(debug)
|
495
523
|
if (SC.LOG_MODULE_LOADING) SC.debug("SC.Module: Module '%@' has completed loading, invoking callbacks.", moduleName);
|
524
|
+
//@endif
|
496
525
|
|
497
526
|
callbacks = moduleInfo.callbacks || [];
|
498
527
|
|
@@ -504,9 +533,11 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
504
533
|
_evaluateAndInvokeCallbacks: function (moduleName) {
|
505
534
|
var moduleInfo = SC.MODULE_INFO;
|
506
535
|
var module = moduleInfo[moduleName];
|
536
|
+
//@if(debug)
|
507
537
|
var log = SC.LOG_MODULE_LOADING;
|
508
538
|
|
509
539
|
if (log) SC.debug("SC.Module: Evaluating and invoking callbacks for '%@'.", moduleName);
|
540
|
+
//@endif
|
510
541
|
|
511
542
|
if (module.source) {
|
512
543
|
this._evaluateStringLoadedModule(module);
|
@@ -526,7 +557,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
526
557
|
_moduleDidBecomeReady: function (moduleName) {
|
527
558
|
var moduleInfo = SC.MODULE_INFO;
|
528
559
|
var module = moduleInfo[moduleName];
|
560
|
+
//@if(debug)
|
529
561
|
var log = SC.LOG_MODULE_LOADING;
|
562
|
+
//@endif
|
530
563
|
|
531
564
|
module.isWaitingForRunLoop = NO;
|
532
565
|
|
@@ -548,7 +581,9 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
548
581
|
dependentName = dependents[idx];
|
549
582
|
dependent = moduleInfo[dependentName];
|
550
583
|
if (dependent.isLoaded && this._dependenciesMetForModule(dependentName)) {
|
584
|
+
//@if(debug)
|
551
585
|
if (log) SC.debug("SC.Module: Now that %@ has loaded, all dependencies for a dependent %@ are met.", moduleName, dependentName);
|
586
|
+
//@endif
|
552
587
|
this._evaluateAndInvokeCallbacks(dependentName);
|
553
588
|
}
|
554
589
|
}
|
@@ -566,20 +601,27 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
566
601
|
*/
|
567
602
|
_moduleDidLoad: function (moduleName) {
|
568
603
|
var module = SC.MODULE_INFO[moduleName];
|
604
|
+
//@if(debug)
|
569
605
|
var log = SC.LOG_MODULE_LOADING;
|
606
|
+
//@endif
|
570
607
|
var dependenciesMet;
|
571
|
-
var callbacks, targets;
|
572
608
|
|
609
|
+
//@if(debug)
|
573
610
|
if (log) SC.debug("SC.Module: Module '%@' finished loading.", moduleName);
|
611
|
+
//@endif
|
574
612
|
|
575
613
|
if (!module) {
|
614
|
+
//@if(debug)
|
576
615
|
if (log) SC.debug("SC._moduleDidLoad() called for unknown module '@'.", moduleName);
|
616
|
+
//@endif
|
577
617
|
module = SC.MODULE_INFO[moduleName] = { isLoaded: YES, isReady: YES };
|
578
618
|
return;
|
579
619
|
}
|
580
620
|
|
581
621
|
if (module.isLoaded) {
|
622
|
+
//@if(debug)
|
582
623
|
if (log) SC.debug("SC._moduleDidLoad() called more than once for module '%@'. Skipping.", moduleName);
|
624
|
+
//@endif
|
583
625
|
return;
|
584
626
|
}
|
585
627
|
|
@@ -592,11 +634,15 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
592
634
|
if (dependenciesMet) {
|
593
635
|
this._evaluateAndInvokeCallbacks(moduleName);
|
594
636
|
} else {
|
637
|
+
//@if(debug)
|
595
638
|
if (log) SC.debug("SC.Module: Dependencies for '%@' not met yet, waiting to evaluate.", moduleName);
|
639
|
+
//@endif
|
596
640
|
}
|
597
641
|
} else {
|
598
642
|
delete module.isPrefetching;
|
643
|
+
//@if(debug)
|
599
644
|
if (log) SC.debug("SC.Module: Module '%@' was prefetched, not evaluating until needed.", moduleName);
|
645
|
+
//@endif
|
600
646
|
}
|
601
647
|
},
|
602
648
|
|
@@ -698,7 +744,7 @@ SC.Module = SC.Object.create(/** @scope SC.Module */ {
|
|
698
744
|
//Yummy variables.
|
699
745
|
var methods = this.get('methodsForSuspend'),
|
700
746
|
calls = this._bufferedCalls,
|
701
|
-
key, i,
|
747
|
+
key, i, call;
|
702
748
|
|
703
749
|
//Restore the original methods to where they belong for normal functionality.
|
704
750
|
for (i = 0; (key = methods[i]); i++) this[key] = this["__saved_" + key + "__"];
|