JSPM

  • Created
  • Published
  • Downloads 20
  • Score
    100M100P100Q93589F

Run modern code in an HTML Application

Package Exports

  • modern-hta
  • modern-hta/modern-hta.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (modern-hta) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

modern-hta

modern-hta bundles @babel/standalone and other polyfills to run modern code in an HTML Application (HTA).

Usage

Sample hta file using cdn.

<meta http-equiv="x-ua-compatible" content="ie=11">
<script src="https://unpkg.com/modern-hta">

  import $ from './$.mjs'
  import data from './data.json'

  log(`Hello World`)

</script>

Or, install and run locally.

Install

npm install modern-hta
<meta http-equiv="x-ua-compatible" content="ie=11">
<script src="node_modules/modern-hta/modern-hta.js">

  log(`Hello World`)

</script>

What's Included...

Polyfills

Globals (to be continued...)

const Babel  // export from @babel/standalone
const script // Element reference to the <script src=modern-hta>
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
}