Created
November 25, 2016 03:52
-
-
Save wonderful-panda/5611ff4e47dfefbde909da09347c21f5 to your computer and use it in GitHub Desktop.
Generate typescript code by template engine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as Electron from "electron"; | |
| export const vuexActions = { | |
| <% | |
| VuexActions.methods.forEach((m, index) => { | |
| const paramListWithType = m.parameters.map(p => `, ${p.prefix}${p.name}${p.postfix}: ${p.typeName}`).join(""); | |
| const paramList = m.parameters.map(p => `, ${p.prefix}${p.name}`).join(""); | |
| const last = index == VuexActions.methods.length - 1; | |
| -%> | |
| <%- m.name %>(target: Electron.WebContents<%- paramListWithType -%>): void { | |
| target.send("action", "<%- m.name %>"<%- paramList -%>); | |
| }<%- last ? "" : "," %> | |
| <% | |
| }); | |
| -%> | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment