-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from magic-script/npm-polyfills
Convert many samples to being based on new template.
- Loading branch information
Showing
89 changed files
with
907 additions
and
4,762 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "Attach Program", | ||
"address": "127.0.0.1", | ||
"port": 9229, | ||
"localRoot": "${workspaceFolder}/bin", | ||
"remoteRoot": ".", | ||
"protocol": "inspector" | ||
} | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
// Rollup config for consuming some npm modules in MagicScript | ||
|
||
import resolve from "rollup-plugin-node-resolve"; | ||
import commonjs from "rollup-plugin-commonjs"; | ||
import executable from "rollup-plugin-executable"; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
|
||
export default { | ||
external: ["uv", "lumin"], | ||
input: "src/main.js", | ||
external: ['uv', 'lumin'], | ||
input: 'src/main.js', | ||
preserveModules: true, | ||
output: { | ||
file: "bin/main.js", | ||
intro: "#!/system/bin/script/mxs\nglobalThis.window=globalThis;", | ||
format: "es", | ||
sourcemap: "external" | ||
dir: 'bin', | ||
format: 'es' | ||
}, | ||
plugins: [resolve(), commonjs(), executable()] | ||
}; | ||
plugins: [resolve(), commonjs()] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { LandscapeApp } from 'lumin'; | ||
import { makeButton } from './button.js'; | ||
|
||
export class App extends LandscapeApp { | ||
init() { | ||
let prism = this.requestNewPrism([0.7, 0.5, 0.5]); | ||
let button = null; | ||
// Add button # 1 | ||
button = makeButton(prism, 'UIButtonStream'); | ||
button.setLocalPosition([0, 0.15, 0]); | ||
prism.getRootNode().addChild(button); | ||
// Add button # 2 | ||
button = makeButton(prism, 'UIButtonHeartPlus'); | ||
button.setLocalPosition([0, 0, 0]); | ||
prism.getRootNode().addChild(button); | ||
// Add button # 3 | ||
button = makeButton(prism, 'UIButtonBlock'); | ||
button.setLocalPosition([0, -0.15, 0]); | ||
prism.getRootNode().addChild(button); | ||
return 0; | ||
} | ||
updateLoop(delta) { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,8 @@ | ||
// | ||
import { LandscapeApp } from "lumin"; | ||
import { makeButton } from "./button.js"; | ||
// Add support for things like setTimeout, setInterval and fetch. | ||
import 'magic-script-polyfills'; | ||
|
||
class App extends LandscapeApp { | ||
init() { | ||
let prism = this.requestNewPrism([0.7, 0.5, 0.5]); | ||
let button = null; | ||
// Add button # 1 | ||
button = makeButton(prism, "UIButtonStream"); | ||
button.setLocalPosition([0, 0.15, 0]); | ||
prism.getRootNode().addChild(button); | ||
// Add button # 2 | ||
button = makeButton(prism, "UIButtonHeartPlus"); | ||
button.setLocalPosition([0, 0, 0]); | ||
prism.getRootNode().addChild(button); | ||
// Add button # 3 | ||
button = makeButton(prism, "UIButtonBlock"); | ||
button.setLocalPosition([0, -0.15, 0]); | ||
prism.getRootNode().addChild(button); | ||
return 0; | ||
} | ||
updateLoop(delta) { | ||
return true; | ||
} | ||
eventListener(event) { | ||
return true; | ||
} | ||
} | ||
// Import our main app | ||
import { App } from './App.js'; | ||
|
||
let app = new App(0.016); | ||
app.run(); | ||
// Launch our app! | ||
new App(0.5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,46 @@ | ||
// ESLint config for MagicScript Apps | ||
module.exports = { | ||
env: { | ||
es6: true | ||
}, | ||
globals: { | ||
print: true, | ||
globalThis: true | ||
}, | ||
extends: "eslint:recommended", | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: "module" | ||
}, | ||
rules: { | ||
indent: ["error", 2], | ||
"linebreak-style": ["error", "unix"], | ||
quotes: ["error", "double"], | ||
semi: ["error", "always"] | ||
} | ||
}; | ||
env: { | ||
"es6": true | ||
}, | ||
globals: { | ||
// These globals are provided by the vm itself. | ||
"print": true, | ||
"globalThis": true, | ||
// The following globals are provided by `magic-script-polyfills` | ||
"setTimeout": true, | ||
"clearTimeout": true, | ||
"setInterval": true, | ||
"clearInterval": true, | ||
"setImmediate": true, | ||
"clearImmediate": true, | ||
"fetch": true, | ||
"Headers": true, | ||
"Request": true, | ||
"Response": true, | ||
|
||
}, | ||
extends: "eslint:recommended", | ||
parserOptions: { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
rules: { | ||
"indent": [ | ||
"error", | ||
2 | ||
], | ||
"linebreak-style": [ | ||
"error", | ||
"unix" | ||
], | ||
"quotes": [ | ||
"error", | ||
"single" | ||
], | ||
"semi": [ | ||
"error", | ||
"always" | ||
] | ||
} | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "Attach Program", | ||
"address": "127.0.0.1", | ||
"port": 9229, | ||
"localRoot": "${workspaceFolder}/bin", | ||
"remoteRoot": ".", | ||
"protocol": "inspector" | ||
} | ||
] | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
// Rollup config for consuming some npm modules in MagicScript | ||
|
||
import resolve from "rollup-plugin-node-resolve"; | ||
import commonjs from "rollup-plugin-commonjs"; | ||
import executable from "rollup-plugin-executable"; | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
|
||
export default { | ||
external: ["uv", "lumin"], | ||
input: "src/main.js", | ||
external: ['uv', 'lumin'], | ||
input: 'src/main.js', | ||
preserveModules: true, | ||
output: { | ||
file: "bin/main.js", | ||
intro: "#!/system/bin/script/mxs\nglobalThis.window=globalThis;", | ||
format: "es", | ||
sourcemap: "inline" | ||
dir: 'bin', | ||
format: 'es' | ||
}, | ||
plugins: [resolve(), commonjs(), executable()] | ||
plugins: [resolve(), commonjs()] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { LandscapeApp } from 'lumin'; | ||
import { makeTextUnderscore } from './text_underscore.js'; | ||
import { makeTextLodash } from './text_lodash.js'; | ||
|
||
export class App extends LandscapeApp { | ||
init() { | ||
let prism = this.requestNewPrism([0.5, 0.5, 0.5]); | ||
|
||
let text_u = makeTextUnderscore(prism); | ||
text_u.setLocalPosition([0, 0.1, 0]); | ||
prism.getRootNode().addChild(text_u); | ||
|
||
let text_l = makeTextLodash(prism); | ||
text_l.setLocalPosition([0, -0.1, 0]); | ||
prism.getRootNode().addChild(text_l); | ||
return 0; | ||
} | ||
updateLoop(delta) { | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,8 @@ | ||
// | ||
import { LandscapeApp } from "lumin"; | ||
import { makeTextUnderscore } from "./text_underscore.js"; | ||
import { makeTextLodash } from "./text_lodash.js"; | ||
// Add support for things like setTimeout, setInterval and fetch. | ||
import 'magic-script-polyfills'; | ||
|
||
class App extends LandscapeApp { | ||
init() { | ||
let prism = this.requestNewPrism([0.5, 0.5, 0.5]); | ||
// Import our main app | ||
import { App } from './App.js'; | ||
|
||
let text_u = makeTextUnderscore(prism); | ||
text_u.setLocalPosition([0, 0.1, 0]); | ||
prism.getRootNode().addChild(text_u); | ||
|
||
let text_l = makeTextLodash(prism); | ||
text_l.setLocalPosition([0, -0.1, 0]); | ||
prism.getRootNode().addChild(text_l); | ||
return 0; | ||
} | ||
updateLoop(delta) { | ||
return true; | ||
} | ||
eventListener(event) { | ||
return true; | ||
} | ||
} | ||
|
||
let app = new App(0.016); | ||
app.run(); | ||
// Launch our app! | ||
new App(0.5); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.