https://github.com/joncasey/modern-hta
  
  
    Run modern code in an HTML Application 
    https://github.com/joncasey/modern-hta
  
babel es2015 es6 hta modern
        Last synced: 7 months ago 
        JSON representation
    
Run modern code in an HTML Application
- Host: GitHub
 - URL: https://github.com/joncasey/modern-hta
 - Owner: joncasey
 - License: mit
 - Created: 2018-02-23T12:25:46.000Z (over 7 years ago)
 - Default Branch: master
 - Last Pushed: 2024-08-23T19:35:27.000Z (about 1 year ago)
 - Last Synced: 2024-08-24T15:11:56.036Z (about 1 year ago)
 - Topics: babel, es2015, es6, hta, modern
 - Language: JavaScript
 - Homepage:
 - Size: 64.5 KB
 - Stars: 17
 - Watchers: 4
 - Forks: 2
 - Open Issues: 0
 - 
            Metadata Files:
            
- Readme: README.md
 - License: LICENSE
 
 
Awesome Lists containing this project
- awesome-electron-alternatives - modern-hta
 
README
          # modern-hta
modern-hta bundles [@babel/standalone](https://github.com/babel/babel/tree/master/packages/babel-standalone) and other [polyfills](#polyfills) to run modern code in an [HTML Application (HTA)](https://en.wikipedia.org/wiki/HTML_Application).
## Usage
Sample `hta` file using [cdn](https://unpkg.com/modern-hta/modern-hta.js).
```html
  import $ from './$.mjs'
  import data from './data.json'
  log(`Hello World`)
```
Or, [install](#install) and run locally.
## Install
```
npm install modern-hta
```
```html
  log(`Hello World`)
```
## What's Included...
## Polyfills
* [core-js](https://github.com/zloirock/core-js)
* [whatwg-fetch](https://github.com/github/fetch)
* `Array.from` - extended to support [Enumerator](https://msdn.microsoft.com/en-us/library/6ch9zb09(v=vs.84).aspx) and [FileSystemObject Collections](https://msdn.microsoft.com/en-us/library/x75sb7ff(v=vs.84).aspx) 
* `Element.closest()`
* `Element.matches()`
* `NodeList.forEach`
## Globals (to be continued...)
```js
const Babel  // export from @babel/standalone
const script // Element reference to the 
const cwd    // current working directory
const fso    // instance of "Scripting.FileSystemObject"
const sys    // instance of "Wscript.Shell"
const xhr    // instance of "Msxml2.XMLHTTP"
function create (tag, html) {
  // returns Element
}
function getSync (url) {
  // returns xhr.responseText
}
function log (any) {
  // returns HTMLDivElement
}
function require (src) {
  // returns ES Module
}
function transform (code, options) {
  // runs Babel.transform w/presets "es2015", "es2016", "es2017", "stage-0"
  // which "stage-0" also includes "stage-1", "stage-2", "stage-3"
  // for my purposes this always runs synchronously
  // returns transpiledCode
}
function watchFile (file, onchange) {
  // this intentionally is a quick/dirty-hack version
  // it runs a setTimeout and checks the last modified date
  // just wanted something super-simple & light-weight for now.
  // returns undefined
}
function windowProps (resize, moveto) {
  // this just simplifies window resizeTo & moveTo calls
  // and, allows them to run as quickly as possible
  // returns undefined
}
```