Basic scripts implementation

This commit is contained in:
Eduard Urbach 2017-06-19 03:59:59 +02:00
parent 12c8e7642d
commit 768b82b1ec
8 changed files with 20 additions and 8 deletions

3
.gitignore vendored
View File

@ -45,3 +45,6 @@ debug
# Log files # Log files
*.log *.log
# JS files
*.js

View File

@ -7,6 +7,7 @@ import (
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
) )
func init() { func init() {
@ -17,7 +18,8 @@ func init() {
// Scripts // Scripts
app.Get("/scripts.js", func(ctx *aero.Context) string { app.Get("/scripts.js", func(ctx *aero.Context) string {
return ctx.File("temp/scripts.js") ctx.SetResponseHeader("Content-Type", "application/javascript")
return components.JS()
}) })
// Favicon // Favicon

View File

@ -25,9 +25,9 @@
"fade", "fade",
"mobile" "mobile"
], ],
"static": [ "scripts": {
"images" "main": "main"
], },
"manifest": { "manifest": {
"short_name": "notify.moe", "short_name": "notify.moe",
"gcm_sender_id": "941298467524", "gcm_sender_id": "941298467524",

5
scripts/hello.ts Normal file
View File

@ -0,0 +1,5 @@
export class Greeter {
greet(name: string) {
console.log("Hello, " + name)
}
}

View File

@ -1 +0,0 @@
console.log("Hello World")

4
scripts/main.ts Normal file
View File

@ -0,0 +1,4 @@
import {Greeter} from "scripts/hello"
var greeter = new Greeter()
greeter.greet("World")

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,6 @@
"moduleResolution": "node", "moduleResolution": "node",
"baseUrl": "./" "baseUrl": "./"
}, },
"compileOnSave": true, "compileOnSave": false,
"buildOnSave": false "buildOnSave": false
} }