sproutcore 1.5.0.rc.1 → 1.5.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION.yml +1 -1
- data/lib/frameworks/sproutcore/Buildfile +9 -4
- data/lib/frameworks/sproutcore/README.md +1 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
- data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
- data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
- data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
- data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
- data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
- data/vendor/chance/lib/chance/instance.rb +8 -6
- metadata +41 -31
- data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
- data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -179,23 +179,23 @@ SC.View.reopen(
|
|
179
179
|
The layout describes how you want your view to be positions on the
|
180
180
|
screen. You can define the following properties:
|
181
181
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
182
|
+
- left: the left edge
|
183
|
+
- top: the top edge
|
184
|
+
- right: the right edge
|
185
|
+
- bottom: the bottom edge
|
186
|
+
- height: the height
|
187
|
+
- width: the width
|
188
|
+
- centerX: an offset from center X
|
189
|
+
- centerY: an offset from center Y
|
190
|
+
- minWidth: a minimum width
|
191
|
+
- minHeight: a minimum height
|
192
|
+
- maxWidth: a maximum width
|
193
|
+
- maxHeight: a maximum height
|
194
|
+
- border: border on all sides
|
195
|
+
- borderTop: top border
|
196
|
+
- borderRight: right border
|
197
|
+
- borderBottom: bottom border
|
198
|
+
- borderLeft: bottom left
|
199
199
|
|
200
200
|
Note that you can only use certain combinations to set layout. For
|
201
201
|
example, you may set left/right or left/width, but not left/width/right,
|
@@ -221,10 +221,8 @@ SC.View.reopen(
|
|
221
221
|
other words, if you want to convert the frame of your view to the global
|
222
222
|
frame, then you should do:
|
223
223
|
|
224
|
-
|
225
|
-
|
226
|
-
var newFrame = pv ? pv.convertFrameToView(frame, null) : frame;
|
227
|
-
}}}
|
224
|
+
var pv = this.get('parentView'), frame = this.get('frame');
|
225
|
+
var newFrame = pv ? pv.convertFrameToView(frame, null) : frame;
|
228
226
|
|
229
227
|
@param {Rect} frame the source frame
|
230
228
|
@param {SC.View} targetView the target view to convert to
|
@@ -263,10 +261,8 @@ SC.View.reopen(
|
|
263
261
|
parentFrame. For example, if you want to convert the frame of view that
|
264
262
|
belongs to another view to the receiver's frame you would do:
|
265
263
|
|
266
|
-
|
267
|
-
|
268
|
-
var newFrame = this.convertFrameFromView(frame, view.get('parentView'));
|
269
|
-
}}}
|
264
|
+
var frame = view.get('frame');
|
265
|
+
var newFrame = this.convertFrameFromView(frame, view.get('parentView'));
|
270
266
|
|
271
267
|
@param {Rect} frame the source frame
|
272
268
|
@param {SC.View} targetView the target view to convert to
|
@@ -16,23 +16,21 @@ sc_require('data_sources/data_source');
|
|
16
16
|
You can use a cascading data source to tie together multiple data sources,
|
17
17
|
treating them as a single namespace.
|
18
18
|
|
19
|
-
|
19
|
+
## Configuring a Cascade Data Source
|
20
20
|
|
21
21
|
You will usually define your cascading data source in your main method after
|
22
22
|
all the classes you have are loaded.
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
MyApp.dataSource = SC.CascadeDataSource.create({
|
25
|
+
dataSources: "prefs youtube photos".w(),
|
26
|
+
|
27
|
+
prefs: MyApp.PrefsDataSource.create({ root: "/prefs" }),
|
28
|
+
youtube: YouTube.YouTubeDataSource.create({ apiKey: "123456" }),
|
29
|
+
photos: MyApp.PhotosDataSource.create({ root: "photos" })
|
30
|
+
|
31
|
+
});
|
27
32
|
|
28
|
-
|
29
|
-
youtube: YouTube.YouTubeDataSource.create({ apiKey: "123456" }),
|
30
|
-
photos: MyApp.PhotosDataSource.create({ root: "photos" })
|
31
|
-
|
32
|
-
});
|
33
|
-
|
34
|
-
MyApp.store.set('dataSource', MyApp.dataSource);
|
35
|
-
}}}
|
33
|
+
MyApp.store.set('dataSource', MyApp.dataSource);
|
36
34
|
|
37
35
|
Note that the order you define your dataSources property will determine the
|
38
36
|
order in which requests will cascade from the store.
|
@@ -40,14 +38,12 @@ sc_require('data_sources/data_source');
|
|
40
38
|
Alternatively, you can use a more jQuery-like API for defining your data
|
41
39
|
sources:
|
42
40
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
.from(MyApp.PhotosDataSource.create({ root: "photos" }));
|
41
|
+
MyApp.dataSource = SC.CascadeDataSource.create()
|
42
|
+
.from(MyApp.PrefsDataSource.create({ root: "/prefs" }))
|
43
|
+
.from(YouTube.YouTubeDataSource.create({ apiKey: "123456" }))
|
44
|
+
.from(MyApp.PhotosDataSource.create({ root: "photos" }));
|
48
45
|
|
49
|
-
|
50
|
-
}}}
|
46
|
+
MyApp.store.set('dataSource', MyApp.dataSource);
|
51
47
|
|
52
48
|
In this case, the order you call from() will determine the order the request
|
53
49
|
will cascade.
|
@@ -13,60 +13,45 @@
|
|
13
13
|
and implement the necessary data source methods to communicate with the
|
14
14
|
particular backend.
|
15
15
|
|
16
|
-
|
17
|
-
h2. Create a Data Source
|
16
|
+
## Create a Data Source
|
18
17
|
|
19
18
|
To implement the data source, subclass `SC.DataSource` in a file located
|
20
19
|
either in the root level of your app or framework, or in a directory
|
21
20
|
called "data_sources":
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
});
|
27
|
-
}}}
|
22
|
+
MyApp.DataSource = SC.DataSource.extend({
|
23
|
+
// implement the data source API...
|
24
|
+
});
|
28
25
|
|
26
|
+
## Connect to a Data Source
|
29
27
|
|
30
|
-
|
31
|
-
|
32
|
-
New SproutCore applications are wired up to fixtures as their data source.
|
28
|
+
New SproutCore applications are wired up to fixtures as their data source.
|
33
29
|
When you are ready to connect to a server, swap the use of fixtures with a
|
34
30
|
call to the desired data source.
|
35
31
|
|
36
32
|
In core.js:
|
37
33
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
store: SC.Store.create().from('MyApp.DataSource')
|
44
|
-
}}}
|
34
|
+
// change...
|
35
|
+
store: SC.Store.create().from(SC.Record.fixtures)
|
36
|
+
|
37
|
+
// to...
|
38
|
+
store: SC.Store.create().from('MyApp.DataSource')
|
45
39
|
|
46
40
|
Note that the data source class name is referenced by string since the file
|
47
41
|
in which it is defined may not have been loaded yet. The first time a
|
48
42
|
data store tries to access its data source it will look up the class name
|
49
43
|
and instantiate that data source.
|
50
44
|
|
45
|
+
## Implement the Data Source API
|
51
46
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
</li>
|
61
|
-
<li>
|
62
|
-
`retrieveRecords()` — called when you access an individual
|
63
|
-
record that has not been loaded yet
|
64
|
-
</li>
|
65
|
-
<li>
|
66
|
-
`commitRecords()` — called if the the store has changes
|
67
|
-
pending and its `commitRecords()` method is invoked.
|
68
|
-
</li>
|
69
|
-
</ul>
|
47
|
+
There are three methods that a data store invokes on its data source:
|
48
|
+
|
49
|
+
* `fetch()` — called the first time you try to `find()` a query
|
50
|
+
on a store or any time you refresh the record array after that.
|
51
|
+
* `retrieveRecords()` — called when you access an individual
|
52
|
+
record that has not been loaded yet
|
53
|
+
* `commitRecords()` — called if the the store has changes
|
54
|
+
pending and its `commitRecords()` method is invoked.
|
70
55
|
|
71
56
|
The data store will call the `commitRecords()` method when records
|
72
57
|
need to be created, updated, or deleted. If the server that the data source
|
@@ -79,48 +64,39 @@
|
|
79
64
|
enough degree, it will be more convenient to rely on the default behavior
|
80
65
|
of `commitRecords()` and instead implement the three methods that
|
81
66
|
it will call by default:
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
</li>
|
92
|
-
<li>
|
93
|
-
`destroyRecords()` — called with a list of records that should
|
94
|
-
be deleted on the server.
|
95
|
-
</li>
|
96
|
-
</ul>
|
97
|
-
|
98
|
-
|
99
|
-
h3. Multiple records
|
67
|
+
|
68
|
+
* `createRecords()` — called with a list of records that are new
|
69
|
+
and need to be created on the server.
|
70
|
+
* `updateRecords()` — called with a list of records that already
|
71
|
+
exist on the server but that need to be updated.
|
72
|
+
* `destroyRecords()` — called with a list of records that should
|
73
|
+
be deleted on the server.
|
74
|
+
|
75
|
+
### Multiple records
|
100
76
|
|
101
77
|
The `retrieveRecords()`, `createRecords()`, `updateRecords()` and
|
102
|
-
`destroyRecords()`
|
103
|
-
API accommodates calls
|
78
|
+
`destroyRecords()` methods all work on multiple records. If your server
|
79
|
+
API accommodates calls where you can pass a list of records, this might
|
104
80
|
be the best level at which to implement the Data Source API. On the other
|
105
81
|
hand, if the server requires that you send commands for it for individual
|
106
82
|
records, you can rely on the default implementation of these four methods,
|
107
83
|
which will call the following for each individual record, one at a time:
|
108
84
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
85
|
+
- `retrieveRecord()` — called to retrieve a single record.
|
86
|
+
- `createRecord()` — called to create a single record.
|
87
|
+
- `updateRecord()` — called to update a single record.
|
88
|
+
- `destroyRecord()` — called to destroy a single record.
|
113
89
|
|
114
90
|
|
115
|
-
|
91
|
+
### Return Values
|
116
92
|
|
117
93
|
All of the methods you implement must return one of three values:
|
118
|
-
|
119
|
-
|
120
|
-
|
94
|
+
- `YES` — all the records were handled.
|
95
|
+
- `NO` — none of the records were handled.
|
96
|
+
- `SC.MIXED_STATE` — some, but not all of the records were handled.
|
121
97
|
|
122
98
|
|
123
|
-
|
99
|
+
### Store Keys
|
124
100
|
|
125
101
|
Whenever a data store invokes one of the data source methods it does so
|
126
102
|
with a storeKeys or storeKey argument. Store keys are transient integers
|
@@ -131,32 +107,21 @@
|
|
131
107
|
When passed a storeKey you can use it to retrieve the status, data hash,
|
132
108
|
record type, or record ID, using the following data store methods:
|
133
109
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
<li>
|
144
|
-
`SC.Store.recordTypeFor(storeKey)` — returns the record type for
|
145
|
-
the associated store key.
|
146
|
-
</li>
|
147
|
-
<li>
|
148
|
-
`recordType.idFor(storeKey)` — returns the record ID for
|
149
|
-
the associated store key. You must call this method on `SC.Record`
|
150
|
-
subclass itself, not on an instance of `SC.Record`.
|
151
|
-
</li>
|
152
|
-
</ul>
|
110
|
+
* `readDataHash(storeKey)` — returns the data hash associated with
|
111
|
+
a store key, if any.
|
112
|
+
* `readStatus(storeKey)` — returns the current record status
|
113
|
+
associated with the store key. May be `SC.Record.EMPTY`.
|
114
|
+
* `SC.Store.recordTypeFor(storeKey)` — returns the record type for
|
115
|
+
the associated store key.
|
116
|
+
* `recordType.idFor(storeKey)` — returns the record ID for
|
117
|
+
the associated store key. You must call this method on `SC.Record`
|
118
|
+
subclass itself, not on an instance of `SC.Record`.
|
153
119
|
|
154
120
|
These methods are safe for reading data from the store. To modify data
|
155
121
|
in the data store you must use the store callbacks described below. The
|
156
122
|
store callbacks will ensure that the record states remain consistent.
|
157
123
|
|
158
|
-
|
159
|
-
h3. Store Callbacks
|
124
|
+
### Store Callbacks
|
160
125
|
|
161
126
|
When a data store calls a data source method, it puts affected records into
|
162
127
|
a `BUSY` state. To guarantee data integrity and consistency, these records
|
@@ -181,35 +146,27 @@
|
|
181
146
|
record can be unlocked right away.
|
182
147
|
|
183
148
|
|
184
|
-
|
149
|
+
### Record-Related Callbacks
|
185
150
|
|
186
151
|
When `retrieveRecords()`, `commitRecords()`, or any of the related methods are
|
187
152
|
called on a data source, the store puts any records to be handled by the data
|
188
153
|
store in a `BUSY` state. To release the records the data source must invoke one
|
189
154
|
of the record-related callbacks on the store:
|
190
155
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
<li>
|
206
|
-
`dataSourceDidCancel(storeKey)` — a data source should call this when
|
207
|
-
an operation is cancelled for some reason. This could be used when the user
|
208
|
-
is able to cancel an operation that is in progress.
|
209
|
-
</li>
|
210
|
-
</ul>
|
211
|
-
|
212
|
-
h3. Loading Records into the Store
|
156
|
+
* `dataSourceDidComplete(storeKey, dataHash, id)` — the most common
|
157
|
+
callback. You might use this callback when you have retrieved a record to
|
158
|
+
load its contents into the store. The callback tells the store that the data
|
159
|
+
source is finished with the storeKey in question. The `dataHash` and `id`
|
160
|
+
arguments are optional and will replace the current dataHash and/or id. Also
|
161
|
+
see "Loading Records" below.
|
162
|
+
* `dataSourceDidError(storeKey, error)` — a data source should call this
|
163
|
+
when a request could not be completed because an error occurred. The error
|
164
|
+
argument is optional and can contain more information about the error.
|
165
|
+
* `dataSourceDidCancel(storeKey)` — a data source should call this when
|
166
|
+
an operation is cancelled for some reason. This could be used when the user
|
167
|
+
is able to cancel an operation that is in progress.
|
168
|
+
|
169
|
+
### Loading Records into the Store
|
213
170
|
|
214
171
|
Instead of orchestrating multiple `dataSourceDidComplete()` callbacks when loading
|
215
172
|
multiple records, a data source can call the `loadRecords()` method on the store,
|
@@ -221,7 +178,7 @@
|
|
221
178
|
the store, especially in response to a `fetch()` or `retrieveRecords()` call.
|
222
179
|
|
223
180
|
|
224
|
-
|
181
|
+
### Query-Related Callbacks
|
225
182
|
|
226
183
|
Like records, queries that are passed through the `fetch()` method also have an
|
227
184
|
associated status property; accessed through the `status` property on the record
|
@@ -229,29 +186,19 @@
|
|
229
186
|
invoke an appropriate query-related callback on the store. The callbacks for
|
230
187
|
queries are similar to those for records:
|
231
188
|
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
this if it encounters an error in executing the query. This puts the query
|
241
|
-
results into an `ERROR` state.
|
242
|
-
</li>
|
243
|
-
<li>
|
244
|
-
`dataSourceDidCancelQuery(query)` — the data source should call this
|
245
|
-
if loading the results is cancelled.
|
246
|
-
</li>
|
247
|
-
</ul>
|
189
|
+
* `dataSourceDidFetchQuery(query)` — the data source must call this when
|
190
|
+
it has completed fetching any related data for the query. This returns the
|
191
|
+
query results (record array) status into a `READY` state.
|
192
|
+
* `dataSourceDidErrorQuery(query, error)` — the data source should call
|
193
|
+
this if it encounters an error in executing the query. This puts the query
|
194
|
+
results into an `ERROR` state.
|
195
|
+
* `dataSourceDidCancelQuery(query)` — the data source should call this
|
196
|
+
if loading the results is cancelled.
|
248
197
|
|
249
198
|
In addition to these callbacks, the method `loadQueryResults(query, storeKey)`
|
250
199
|
is used by data sources when handling remote queries. This method is similar to
|
251
200
|
`dataSourceDidFetchQuery()`, except that you also provide an array of storeKeys
|
252
201
|
(or a promise to provide store keys) that comprises the result set.
|
253
|
-
|
254
|
-
|
255
202
|
|
256
203
|
@extend SC.Object
|
257
204
|
@since SproutCore 1.0
|
@@ -272,7 +219,7 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
272
219
|
needed to fulfill the query. If the query is a remote query, then you
|
273
220
|
will also need to provide the contents of the query as well.
|
274
221
|
|
275
|
-
|
222
|
+
### Handling Local Queries
|
276
223
|
|
277
224
|
Most queries you create in your application will be local queries. Local
|
278
225
|
queries are populated automatically from whatever data you have in memory.
|
@@ -289,7 +236,7 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
289
236
|
not to load any new data into the store in order to notify that the store
|
290
237
|
that you think it is ready to return results for the query.
|
291
238
|
|
292
|
-
|
239
|
+
### Handling Remote Queries
|
293
240
|
|
294
241
|
Remote queries are special queries whose results will be populated by the
|
295
242
|
server instead of from memory. Usually you will only need to use this
|
@@ -307,7 +254,7 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
307
254
|
queries, you can do so by passing a SC.SparseArray instance instead of
|
308
255
|
a regular array of storeKeys and then populate the sparse array on demand.
|
309
256
|
|
310
|
-
|
257
|
+
### Handling Errors and Cancelations
|
311
258
|
|
312
259
|
If you encounter an error while trying to fetch the results for a query
|
313
260
|
you can call SC.Store#dataSourceDidErrorQuery() instead. This will put
|
@@ -318,7 +265,7 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
318
265
|
the query back into the state it was in previously before it started
|
319
266
|
loading the query.
|
320
267
|
|
321
|
-
|
268
|
+
### Return Values
|
322
269
|
|
323
270
|
When you return from this method, be sure to return a Boolean. YES means
|
324
271
|
you handled the query, NO means you can't handle the query. When using
|
@@ -355,21 +302,21 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
355
302
|
changes that need to be sent back to the server. The store keys will be
|
356
303
|
separated into three categories:
|
357
304
|
|
358
|
-
- createStoreKeys
|
359
|
-
- updateStoreKeys
|
360
|
-
- destroyStoreKeys
|
305
|
+
- `createStoreKeys`: records that need to be created on server
|
306
|
+
- `updateStoreKeys`: existing records that have been modified
|
307
|
+
- `destroyStoreKeys`: records need to be destroyed on the server
|
361
308
|
|
362
309
|
If you do not override this method yourself, this method will actually
|
363
|
-
invoke createRecords()
|
310
|
+
invoke `createRecords()`, `updateRecords()`, and `destroyRecords()` on the
|
364
311
|
dataSource, passing each array of storeKeys. You can usually implement
|
365
312
|
those methods instead of overriding this method.
|
366
313
|
|
367
314
|
However, if your server API can sync multiple changes at once, you may
|
368
315
|
prefer to override this method instead.
|
369
316
|
|
370
|
-
To support cascading data stores, be sure to return NO if you cannot
|
371
|
-
handle any of the keys, YES if you can handle all of the keys, or
|
372
|
-
SC.MIXED_STATE if you can handle some of them.
|
317
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
318
|
+
handle any of the keys, `YES` if you can handle all of the keys, or
|
319
|
+
`SC.MIXED_STATE` if you can handle some of them.
|
373
320
|
|
374
321
|
@param {SC.Store} store the requesting store
|
375
322
|
@param {Array} createStoreKeys keys to create
|
@@ -400,14 +347,14 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
400
347
|
Invoked by the store whenever it needs to cancel one or more records that
|
401
348
|
are currently in-flight. If any of the storeKeys match records you are
|
402
349
|
currently acting upon, you should cancel the in-progress operation and
|
403
|
-
return YES
|
350
|
+
return `YES`.
|
404
351
|
|
405
352
|
If you implement an in-memory data source that immediately services the
|
406
353
|
other requests, then this method will never be called on your data source.
|
407
354
|
|
408
|
-
To support cascading data stores, be sure to return NO if you cannot
|
409
|
-
retrieve any of the keys, YES if you can retrieve all of the, or
|
410
|
-
SC.MIXED_STATE if you can retrieve some of the.
|
355
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
356
|
+
retrieve any of the keys, `YES` if you can retrieve all of the, or
|
357
|
+
`SC.MIXED_STATE` if you can retrieve some of the.
|
411
358
|
|
412
359
|
@param {SC.Store} store the requesting store
|
413
360
|
@param {Array} storeKeys array of storeKeys to retrieve
|
@@ -422,14 +369,14 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
422
369
|
//
|
423
370
|
|
424
371
|
/**
|
425
|
-
Called from commitRecords() to commit modified existing records to the
|
372
|
+
Called from `commitRecords()` to commit modified existing records to the
|
426
373
|
store. You can override this method to actually send the updated
|
427
374
|
records to your store. The default version will simply call
|
428
|
-
updateRecord() for each storeKey.
|
375
|
+
`updateRecord()` for each storeKey.
|
429
376
|
|
430
|
-
To support cascading data stores, be sure to return NO if you cannot
|
431
|
-
handle any of the keys, YES if you can handle all of the keys, or
|
432
|
-
SC.MIXED_STATE if you can handle some of them.
|
377
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
378
|
+
handle any of the keys, `YES` if you can handle all of the keys, or
|
379
|
+
`SC.MIXED_STATE` if you can handle some of them.
|
433
380
|
|
434
381
|
@param {SC.Store} store the requesting store
|
435
382
|
@param {Array} storeKeys keys to update
|
@@ -445,14 +392,14 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
445
392
|
},
|
446
393
|
|
447
394
|
/**
|
448
|
-
Called from commitRecords() to commit newly created records to the
|
395
|
+
Called from `commitRecords()` to commit newly created records to the
|
449
396
|
store. You can override this method to actually send the created
|
450
397
|
records to your store. The default version will simply call
|
451
|
-
createRecord() for each storeKey.
|
398
|
+
`createRecord()` for each storeKey.
|
452
399
|
|
453
|
-
To support cascading data stores, be sure to return NO if you cannot
|
454
|
-
handle any of the keys, YES if you can handle all of the keys, or
|
455
|
-
SC.MIXED_STATE if you can handle some of them.
|
400
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
401
|
+
handle any of the keys, `YES` if you can handle all of the keys, or
|
402
|
+
`SC.MIXED_STATE` if you can handle some of them.
|
456
403
|
|
457
404
|
@param {SC.Store} store the requesting store
|
458
405
|
@param {Array} storeKeys keys to update
|
@@ -469,14 +416,14 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
469
416
|
},
|
470
417
|
|
471
418
|
/**
|
472
|
-
Called from commitRecords() to commit destroted records to the
|
419
|
+
Called from `commitRecords()` to commit destroted records to the
|
473
420
|
store. You can override this method to actually send the destroyed
|
474
421
|
records to your store. The default version will simply call
|
475
|
-
destroyRecord() for each storeKey.
|
422
|
+
`destroyRecord()` for each storeKey.
|
476
423
|
|
477
|
-
To support cascading data stores, be sure to return NO if you cannot
|
478
|
-
handle any of the keys, YES if you can handle all of the keys, or
|
479
|
-
SC.MIXED_STATE if you can handle some of them.
|
424
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
425
|
+
handle any of the keys, `YES` if you can handle all of the keys, or
|
426
|
+
`SC.MIXED_STATE` if you can handle some of them.
|
480
427
|
|
481
428
|
@param {SC.Store} store the requesting store
|
482
429
|
@param {Array} storeKeys keys to update
|
@@ -518,11 +465,11 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
518
465
|
//
|
519
466
|
|
520
467
|
/**
|
521
|
-
Called from updatesRecords() to update a single record. This is the
|
468
|
+
Called from `updatesRecords()` to update a single record. This is the
|
522
469
|
most basic primitive to can implement to support updating a record.
|
523
470
|
|
524
|
-
To support cascading data stores, be sure to return NO if you cannot
|
525
|
-
handle the passed storeKey or YES if you can.
|
471
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
472
|
+
handle the passed storeKey or `YES` if you can.
|
526
473
|
|
527
474
|
@param {SC.Store} store the requesting store
|
528
475
|
@param {Array} storeKey key to update
|
@@ -535,7 +482,7 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
535
482
|
},
|
536
483
|
|
537
484
|
/**
|
538
|
-
Called from retrieveRecords() to retrieve a single record.
|
485
|
+
Called from `retrieveRecords()` to retrieve a single record.
|
539
486
|
|
540
487
|
@param {SC.Store} store the requesting store
|
541
488
|
@param {Array} storeKey key to retrieve
|
@@ -547,11 +494,11 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
547
494
|
},
|
548
495
|
|
549
496
|
/**
|
550
|
-
Called from createdRecords() to created a single record. This is the
|
497
|
+
Called from `createdRecords()` to created a single record. This is the
|
551
498
|
most basic primitive to can implement to support creating a record.
|
552
499
|
|
553
|
-
To support cascading data stores, be sure to return NO if you cannot
|
554
|
-
handle the passed storeKey or YES if you can.
|
500
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
501
|
+
handle the passed storeKey or `YES` if you can.
|
555
502
|
|
556
503
|
@param {SC.Store} store the requesting store
|
557
504
|
@param {Array} storeKey key to update
|
@@ -564,11 +511,11 @@ SC.DataSource = SC.Object.extend( /** @scope SC.DataSource.prototype */ {
|
|
564
511
|
},
|
565
512
|
|
566
513
|
/**
|
567
|
-
Called from destroyRecords() to destroy a single record. This is the
|
514
|
+
Called from `destroyRecords()` to destroy a single record. This is the
|
568
515
|
most basic primitive to can implement to support destroying a record.
|
569
516
|
|
570
|
-
To support cascading data stores, be sure to return NO if you cannot
|
571
|
-
handle the passed storeKey or YES if you can.
|
517
|
+
To support cascading data stores, be sure to return `NO` if you cannot
|
518
|
+
handle the passed storeKey or `YES` if you can.
|
572
519
|
|
573
520
|
@param {SC.Store} store the requesting store
|
574
521
|
@param {Array} storeKey key to update
|
@@ -39,10 +39,10 @@ SC.FixturesDataSource = SC.DataSource.extend(
|
|
39
39
|
here. You should tune this to simulate latency based on the expected
|
40
40
|
performance of your server network. Here are some good guidelines:
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
- 500: Simulates a basic server written in PHP, Ruby, or Python (not twisted) without a CDN in front for caching.
|
43
|
+
- 250: (Default) simulates the average latency needed to go back to your origin server from anywhere in the world. assumes your servers itself will respond to requests < 50 msec
|
44
|
+
- 100: simulates the latency to a "nearby" server (i.e. same part of the world). Suitable for simulating locally hosted servers or servers with multiple data centers around the world.
|
45
|
+
- 50: simulates the latency to an edge cache node when using a CDN. Life is really good if you can afford this kind of setup.
|
46
46
|
|
47
47
|
@property {Number}
|
48
48
|
*/
|
@@ -10,17 +10,15 @@ sc_require('models/record_attribute');
|
|
10
10
|
|
11
11
|
/** @class
|
12
12
|
|
13
|
-
ChildAttribute is a subclass of RecordAttribute and handles to-one
|
13
|
+
ChildAttribute is a subclass of `RecordAttribute` and handles to-one
|
14
14
|
relationships for child records.
|
15
15
|
|
16
|
-
When setting (
|
17
|
-
to pass in an array of SC.Record objects.
|
16
|
+
When setting ( `.set()` ) the value of a toMany attribute, make sure
|
17
|
+
to pass in an array of `SC.Record` objects.
|
18
18
|
|
19
19
|
There are many ways you can configure a ManyAttribute:
|
20
20
|
|
21
|
-
|
22
|
-
contacts: SC.ChildAttribute.attr('SC.Child');
|
23
|
-
}}}
|
21
|
+
contacts: SC.ChildAttribute.attr('SC.Child');
|
24
22
|
|
25
23
|
@extends SC.RecordAttribute
|
26
24
|
@since SproutCore 1.0
|