Skip to content

Commit

Permalink
[upd] support lazy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
hefangshi committed Oct 16, 2015
1 parent a0cf5e4 commit 7f7d51c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Swig.prototype._w = Swig.prototype._widget = function (layer, id, attr, options)
var self = this;
var pathname = layer.resolve(id);

if (!layer.supportBigPipe() || !attr.mode || attr.mode === 'sync' || layer.isPagelet) {
if (!layer.supportBigPipe() || !attr.mode || attr.mode === 'sync') {
layer.load(id);
return this.compileFile(pathname, options);
}
Expand All @@ -121,6 +121,7 @@ Swig.prototype._w = Swig.prototype._widget = function (layer, id, attr, options)
container: container,
model: attr.model,
id: attr.id,
lazy: attr.lazy === 'true',
mode: attr.mode,
locals: locals,
view: pathname,
Expand All @@ -135,4 +136,4 @@ Swig.prototype._w = Swig.prototype._widget = function (layer, id, attr, options)

return container ? '' : '<div id="' + attr.id + '"></div>';
};
};
};
2 changes: 1 addition & 1 deletion tags/spage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var ignore = 'ignore',
missing = 'missing',
only = 'only',
attrs = ["id", "mode", "group", "for", "model"];
attrs = ["id", "mode", "group", "for", "model", "lazy", "cache"];

/**
* Includes a template partial in place. The template is rendered within the current locals variable context.
Expand Down
2 changes: 1 addition & 1 deletion tags/widget.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var ignore = 'ignore',
missing = 'missing',
only = 'only',
attrs = ["id", "mode", "group", "for", "model"];
attrs = ["id", "mode", "group", "for", "model", "lazy", "cache"];

/**
* Includes a template partial in place. The template is rendered within the current locals variable context.
Expand Down

0 comments on commit 7f7d51c

Please sign in to comment.