Skip to content

Commit d7087fa

Browse files
committed
feat(object_factory): Make all engines async
1 parent 921b513 commit d7087fa

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

core/lib/object_factory.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,36 +102,30 @@ const Pattern = function (relPath, data, patternlab) {
102102
Pattern.prototype = {
103103

104104
renderSync: function (data, partials) {
105-
if (this.engine && !this.engine.isAsync) {
105+
if (this.engine) {
106106
const results = this.engine.renderPattern(this, data || this.jsonFileData, partials);
107107
return results;
108-
109108
}
110109
return null;
111110
},
112111

113112
// render function - acts as a proxy for the PatternEngine's
114113
render: function (data, partials) {
115114

116-
117115
if (!this.extendedTemplate) {
118116
this.extendedTemplate = this.template;
119117
}
120118

121-
122-
if (this.engine && this.engine.isAsync) {
119+
if (this.engine) {
123120
const promise = this.engine.renderPattern(this, data || this.jsonFileData, partials);
124121
return promise.then(results => {
125122
return results;
126123
}).catch((reason) => {
124+
console.log(reason)
127125
return Promise.reject(reason);
128126
});
129-
} else {
130-
// renderSync
131-
return Promise.resolve(
132-
this.renderSync(data, partials)
133-
);
134127
}
128+
return Promise.reject('where is the engine?');
135129
},
136130

137131
registerPartial: function () {

0 commit comments

Comments
 (0)