Skip to content

Commit 22d4132

Browse files
committed
build release 0.3.3
1 parent d4afbde commit 22d4132

15 files changed

+136
-118
lines changed

dist/blocks-source.js

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
return value;
3838
};
3939

40-
blocks.version = '0.3.2';
40+
blocks.version = '0.3.3';
4141
blocks.core = core;
4242

4343
/**
@@ -8658,6 +8658,8 @@ return result;
86588658
blocks.each(createVirtual(this.childNodes[0]), function (element) {
86598659
if (VirtualElement.Is(element)) {
86608660
element.sync(domQuery);
8661+
} else if (element && element.isExpression && element.element) {
8662+
element.element.nodeValue = Expression.GetValue(domQuery._context, null, element);
86618663
}
86628664
});
86638665
domQuery.createElementObservableDependencies(this.childNodes);
@@ -9738,7 +9740,7 @@ return result;
97389740
return this;
97399741
},
97409742

9741-
sync: function () {
9743+
sync: function (callback) {
97429744
var _this = this;
97439745
var changes = this._changes;
97449746
var changesLeft = changes.length;
@@ -9755,11 +9757,15 @@ return result;
97559757
}, function () {
97569758
changesLeft--;
97579759
if (!changesLeft) {
9760+
if (blocks.isFunction(callback)) {
9761+
callback();
9762+
}
97589763
_this._trigger('sync');
97599764
}
97609765
});
97619766
});
97629767
});
9768+
97639769
return this.clearChanges();
97649770
},
97659771

@@ -10209,13 +10215,15 @@ return result;
1020910215
* Synchronizes the changes with the server by sending requests to the provided URL's
1021010216
*
1021110217
* @memberof Model
10218+
* @param {Function} [callback] - Optional callback which will be executed
10219+
* when all sync operations have been successfully completed
1021210220
* @returns {Model} - Returns the Model itself - return this;
1021310221
*/
10214-
sync: function () {
10222+
sync: function (callback) {
1021510223
if (this.isNew()) {
1021610224
this._dataSource.data.add(this.dataItem());
1021710225
}
10218-
this._dataSource.sync();
10226+
this._dataSource.sync(callback);
1021910227
return this;
1022010228
},
1022110229

@@ -10723,6 +10731,8 @@ return result;
1072310731
* with a database.
1072410732
*
1072510733
* @memberof Collection
10734+
* @param {Function} [callback] - Optional callback which will be executed
10735+
* when all sync operations have been successfully completed
1072610736
* @returns {Collection} - Chainable. Returns the Collection itself - return this;
1072710737
*
1072810738
* @example {javascript}
@@ -10748,8 +10758,8 @@ return result;
1074810758
* }
1074910759
* });
1075010760
*/
10751-
sync: function () {
10752-
this._dataSource.sync();
10761+
sync: function (callback) {
10762+
this._dataSource.sync(callback);
1075310763
return this;
1075410764
},
1075510765

@@ -10846,24 +10856,18 @@ return result;
1084610856
function View(application, parentView, prototype) {
1084710857
var _this = this;
1084810858
var options = this.options;
10849-
var views = this._views = [];
10850-
var hasRoute = blocks.has(options, 'route');
1085110859

1085210860
clonePrototype(prototype, this);
1085310861

10862+
this._views = [];
1085410863
this._application = application;
1085510864
this._parentView = parentView || null;
1085610865
this._initCalled = false;
1085710866
this._html = undefined;
1085810867

1085910868
this.loading = blocks.observable(false);
10860-
this.isActive = blocks.observable(!hasRoute);
10869+
this.isActive = blocks.observable(!blocks.has(options, 'route'));
1086110870
this.isActive.on('changing', function (oldValue, newValue) {
10862-
blocks.each(views, function (view) {
10863-
if (!hasRoute) {
10864-
view.isActive(newValue);
10865-
}
10866-
});
1086710871
_this._tryInitialize(newValue);
1086810872
});
1086910873

@@ -10907,10 +10911,10 @@ return result;
1090710911
/**
1090810912
* Override the ready method to perform actions when the DOM is ready and
1090910913
* all data-query have been executed.
10910-
*
10914+
*
1091110915
* @memberof View
1091210916
* @type {Function}
10913-
*
10917+
*
1091410918
* @example {javascript}
1091510919
* var App = blocks.Application();
1091610920
*
@@ -10943,20 +10947,20 @@ return result;
1094310947
* });
1094410948
*/
1094510949
routed: blocks.noop,
10946-
10950+
1094710951
/**
1094810952
* Observable which value is true when the View html
1094910953
* is being loaded using ajax request. It could be used
1095010954
* to show a loading indicator.
10951-
*
10955+
*
1095210956
* @memberof View
1095310957
*/
1095410958
loading: blocks.observable(false),
1095510959

1095610960
/**
1095710961
* Gets the parent view.
1095810962
* Returns null if the view is not a child of another view.
10959-
*
10963+
*
1096010964
* @memberof View
1096110965
*/
1096210966
parentView: function () {
@@ -11013,7 +11017,7 @@ return result;
1101311017
this._tryInitialize(true);
1101411018
this.routed(params, metadata);
1101511019
blocks.each(this._views, function (view) {
11016-
if (view.isActive()) {
11020+
if (!view.options.route) {
1101711021
view._routed(params, metadata);
1101811022
}
1101911023
});

0 commit comments

Comments
 (0)