newproj.js 1021 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. const vscode = acquireVsCodeApi();
  6. document.getElementById('btn_submit').onclick = () => {
  7. submitFunc();
  8. };
  9. function submitFunc() {
  10. let projectName = document.getElementById('ipt_projName').value;
  11. let template = document.getElementById('select_dropdown').value;
  12. vscode.postMessage({
  13. command: 'create_new_project',
  14. projectName: projectName,
  15. template: template,
  16. });
  17. /* get msg from ext */
  18. window.addEventListener('message', event => {
  19. const message = event.data;
  20. switch (message.command) {
  21. /* send command to open the project */
  22. case 'proj_creation_finish':
  23. vscode.postMessage({
  24. command: 'open_project',
  25. projectName: message.prjName,
  26. });
  27. break;
  28. default:
  29. break;
  30. }
  31. });
  32. }