Skip to content

Instantly share code, notes, and snippets.

@stemcstudio
Last active September 24, 2022 21:41
Show Gist options
  • Save stemcstudio/bd81c7ef6846e52223cb30a9ce2961b9 to your computer and use it in GitHub Desktop.
Save stemcstudio/bd81c7ef6846e52223cb30a9ce2961b9 to your computer and use it in GitHub Desktop.
Internal Module Example

STEMCstudio Application

Purpose

This application may be used as a starting point for creating new applications in STEMCstudio. The application entrypoint is index.html. A README.md file is provided for documentation.

Application

index.html

This file is the entrypoint for your application.

index.ts

This file will be transpiled into JavaScript and will be used in index.html.

style.ccs

This file is the Cascading Style Sheet (CSS) that will style your application. It is also used to style the README.

Documentation

README.md

This markdown file describes your application. It supports LaTeX using MathJax...

$$E = m c^2$$

/**
* Constructs a personalized string that can be used to greet a person.
* @param name The name of the person receiving the greeting.
* @returns a greeting string containing the name of the person receiving the greeting.
*/
export function greeting(name: string): string {
return `Hello, ${name}!`
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="/">
<style>
body {
background-color: #ffffff;
}
</style>
<script src="https://stemcstudio.com:/assets/js/stemcstudio-systemjs@1.0.0/system.js"></script>
</head>
<body>
<script>
System.config({
"warnings": false,
"map": {}
});
</script>
<h1 id="title">Hello, World!</h1>
<script>
System.register("./index.js", ["./foo.js"], function (exports_1, context_1) {
"use strict";
var foo_js_1, titleElement;
var __moduleName = context_1 && context_1.id;
return {
setters: [
function (foo_js_1_1) {
foo_js_1 = foo_js_1_1;
}
],
execute: function () {
titleElement = document.getElementById('title');
if (titleElement) {
titleElement.textContent = foo_js_1.greeting("World");
}
window.onunload = function () {
};
}
};
});
System.register("./foo.js", [], function (exports_1, context_1) {
"use strict";
var __moduleName = context_1 && context_1.id;
function greeting(name) {
return `Hello, ${name}!`;
}
exports_1("greeting", greeting);
return {
setters: [],
execute: function () {
}
};
});
</script>
<script>
System.defaultJSExtensions = true
System.import('./index.js').catch(function(e) { console.error(e) })
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<base href="/">
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1 id='title'>Hello, World!</h1>
</body>
</html>
import { greeting } from "./foo.js"
const titleElement = document.getElementById('title')
if (titleElement) {
titleElement.textContent = greeting("World")
}
window.onunload = function() {
// Write your application cleanup code here.
}
/**
* Constructs a personalized string that can be used to greet a person.
* @param name The name of the person receiving the greeting.
* @returns a greeting string containing the name of the person receiving the greeting.
*/
export function greeting(name: string): string {
return `Hello, ${name}!`
}
{
"description": "Internal Module Example",
"dependencies": {},
"name": "internal-module-example",
"version": "1.0.0",
"keywords": [
"STEMCstudio",
"template",
"stemcbook"
],
"linting": true,
"author": "David Geo Holmes",
"noLoopCheck": true
}
body {
background-color: #ffffff;
}
{
"allowJs": true,
"allowUnreachableCode": false,
"checkJs": false,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"module": "system",
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"removeComments": true,
"skipLibCheck": true,
"sourceMap": false,
"strict": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es2016",
"traceResolution": true
}
{
"rules": {
"array-type": [
true,
"array"
],
"curly": false,
"comment-format": [
true,
"check-space"
],
"eofline": true,
"forin": true,
"jsdoc-format": true,
"new-parens": true,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": true,
"no-construct": true,
"no-for-in-array": true,
"no-inferrable-types": [
true
],
"no-magic-numbers": false,
"no-shadowed-variable": true,
"no-string-throw": true,
"no-trailing-whitespace": [
true,
"ignore-jsdoc"
],
"no-var-keyword": true,
"one-variable-per-declaration": [
true,
"ignore-for-loop"
],
"prefer-const": true,
"prefer-for-of": true,
"prefer-function-over-method": false,
"prefer-method-signature": true,
"radix": true,
"semicolon": [true, "never"],
"trailing-comma": [
true,
{
"multiline": "never",
"singleline": "never"
}
],
"triple-equals": true,
"use-isnan": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment