Skip to content

Commit

Permalink
Merge pull request #194 from SgLy/fix-event-listener-wrapper-compatib…
Browse files Browse the repository at this point in the history
…ility

fix(template-compiler): made new template compile result compatible with old core
  • Loading branch information
LastLeaf committed Aug 27, 2024
2 parents fe4cc36 + 22b190a commit 4776bae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions glass-easel-template-compiler/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ const EXTRA_RUNTIME_ITEMS: [(&'static str, &'static str); 2] = [
("b", "function(b){var a=Object.values(b);for(var i=0;i<a.length;i++)if(a[i])return a}"),
];

const WXS_RUNTIME_ITEMS: [(&'static str, &'static str); 1] = [
const WXS_RUNTIME_ITEMS: [(&'static str, &'static str); 2] = [
("A", "function(a){return a}"),
// "B" "C" are preserved
("B", "function(a){return a}"),
// "C" is preserved
];

const WXS_RUNTIME: &'static str = r#"
Expand Down
2 changes: 1 addition & 1 deletion glass-easel-template-compiler/src/proc_gen/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Template {
Ok(())
})?;
w.expr_stmt(|w| {
write!(w, "R.setEventListenerWrapper(Q.C)")?;
write!(w, "if(typeof R.setEventListenerWrapper==='function')R.setEventListenerWrapper(Q.C)")?;
Ok(())
})?;
}
Expand Down

0 comments on commit 4776bae

Please sign in to comment.