Skip to content

Commit

Permalink
remove data function from mvl
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Aug 19, 2018
1 parent 9342602 commit 322d1bd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/moon-mvl/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ module.exports = (name, input, hot) => {
outputJS = inputJS.replace("export default", "const _moonOptions=");
}

outputJS = `import Moon from "moon";export default Moon.extend("${name}",function(){${outputJS}_moonOptions.view=function(m,instance,locals){${Moon.generate(tree, null)}};return _moonOptions;});`;
outputJS = `import Moon from "moon";${outputJS}_moonOptions.view=function(m,instance,locals){${Moon.generate(tree, null)}};export default Moon.extend("${name}",_moonOptions);`;

if (hot) {
outputJS = `
import { registerJS, registerCSS } from "moon-mvl/lib/hot";
const _moonRemoveJS = [];
const _moonRemoveCSS = registerCSS(\`${outputCSS}\`);
${
outputJS.replace("return _moonOptions;", `
outputJS.replace("export default", `
const _moonOnCreate = _moonOptions.onCreate;
_moonOptions.onCreate = function() {
_moonRemoveJS.push(registerJS(this));
if (_moonOnCreate !== undefined) {
_moonOnCreate();
_moonOnCreate(this, []);
}
};
$&
Expand Down

0 comments on commit 322d1bd

Please sign in to comment.