Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
flyover committed Mar 8, 2019
1 parent c6cf2ca commit 367f07a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 31 deletions.
4 changes: 2 additions & 2 deletions example/index.html
@@ -1,12 +1,12 @@
<html>
<head>
<title>msdfgen</title>
<title>msdfgen example</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <script type="text/javascript" src="../node_modules/systemjs/dist/system.js"></script> -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.21.6/system.js"></script>
<script type="text/javascript" src="system.config.js"></script>
<script type="text/javascript">
SystemJS.import("./main.js")
SystemJS.import("./main")
.then(function (main) {
main.default()
.then(function () {
Expand Down
21 changes: 1 addition & 20 deletions example/index.js
Expand Up @@ -3,32 +3,13 @@

require("source-map-support").install();

global["fetch"] = (url) => {
return new Promise((resolve, reject) => {
const fs = require('fs');
if (!fs.existsSync(url)) {
reject(`File not found: ${url}`);
}
const readStream = fs.createReadStream(url);
readStream.on('open', function () {
const Response = require('node-fetch').Response;
resolve(new Response(readStream, {
status: 200,
statusText: 'OK'
}));
});
});
};

process.chdir(__dirname);

global["SystemJS"] = require("systemjs");

// SystemJS.config({ map: { "fs": "@node/fs" } });

module.require("./system.config");

SystemJS.import("./main.js")
SystemJS.import("./main")
.then(function (main) {
main.default()
.then(function () {
Expand Down
2 changes: 1 addition & 1 deletion example/main.ts
@@ -1,4 +1,4 @@
import * as msdfgen from "msdfgen";
import * as msdfgen from "msdfgen-core";

export default async function main(): Promise<void> {
console.log("msdfgen version", msdfgen.VERSION);
Expand Down
11 changes: 5 additions & 6 deletions example/system.config.js
@@ -1,8 +1,7 @@
SystemJS.config({
map: {
"msdfgen": "../core",
},
packages: {
"msdfgen": { main: "index.js", },
}
map: { "msdfgen-core": "../core" },
packages: { "msdfgen-core": { main: "index.js", } }
});
SystemJS.config({
packages: { ".": { defaultExtension: "js" } }
});
4 changes: 2 additions & 2 deletions example/tsconfig.json
Expand Up @@ -7,8 +7,8 @@
"strict": true,
"baseUrl": ".",
"paths": {
"msdfgen": [ "../core" ],
"msdfgen/*": [ "../core/*" ]
"msdfgen-core": [ "../core" ],
"msdfgen-core/*": [ "../core/*" ]
}
},
"files": [
Expand Down

0 comments on commit 367f07a

Please sign in to comment.