Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api demo failed #42

Closed
elycheikhsmail opened this issue May 23, 2022 · 4 comments
Closed

Api demo failed #42

elycheikhsmail opened this issue May 23, 2022 · 4 comments

Comments

@elycheikhsmail
Copy link

elycheikhsmail commented May 23, 2022

I create gui.ts file and copy past


import { AppWindow  } from "https://deno.land/x/astrodon/mod.ts";

const win = new AppWindow("Window A");

win.setHtml("<h1>Hello World :)</h1>");

await win.run();

I get the following error :

ely@ely-ThinkPad-T450s:~/Documents/fullstack/astrodon-explore$ deno run -A --unstable gui.ts
Check file:///home/ely/Documents/fullstack/astrodon-explore/gui.ts
error: TS2305 [ERROR]: Module '"https://deno.land/x/astrodon@0.1.0-alpha.2/mod.ts"' has no exported member 'AppWindow'.
import { AppWindow  } from "https://deno.land/x/astrodon/mod.ts";
         ~~~~~~~~~
    at file:///home/ely/Documents/fullstack/astrodon-explore/gui.ts:1:10

@marc2332
Copy link
Member

marc2332 commented May 23, 2022

That API is WIP.

Follow this example: https://deno.land/x/astrodon@0.1.0-alpha.2/examples/hello_world/demo.ts

@marc2332 marc2332 changed the title https://astrodon.land/ home page demo failed Api demo failed May 23, 2022
@elycheikhsmail
Copy link
Author

I made this change

import { App  } from "https://deno.land/x/astrodon/mod.ts";

export const getIndex = async () => {
  const isDev = Deno.env.get("DEV") == "true";
 
  //deno-lint-ignore no-explicit-any
  const isProd = (globalThis as any).astrodonProduction

  if (isDev || isProd) {
    return `file://${ await Deno.realPath('./renderer/index.html')}`;
  } else {
    return `https://raw.githack.com/astrodon/astrodon/dev/examples/hello_world/renderer/index.html` //"<your_remote_html>";
  }
};

const indexPath = await getIndex();

const app = await App.new();

await app.registerWindow({ title: "spaghettis > ravioli", url: indexPath });

setInterval(() => {
  app.send(`Hello Tauri: ${Math.random()}`);
}, 500);

app.run();

and it work as standalone script
thank you
why not fix this in asrodon.land ?

@marc2332
Copy link
Member

I made this change

import { App  } from "https://deno.land/x/astrodon/mod.ts";

export const getIndex = async () => {
  const isDev = Deno.env.get("DEV") == "true";
 
  //deno-lint-ignore no-explicit-any
  const isProd = (globalThis as any).astrodonProduction

  if (isDev || isProd) {
    return `file://${ await Deno.realPath('./renderer/index.html')}`;
  } else {
    return `https://raw.githack.com/astrodon/astrodon/dev/examples/hello_world/renderer/index.html` //"<your_remote_html>";
  }
};

const indexPath = await getIndex();

const app = await App.new();

await app.registerWindow({ title: "spaghettis > ravioli", url: indexPath });

setInterval(() => {
  app.send(`Hello Tauri: ${Math.random()}`);
}, 500);

app.run();

and it work as standalone script
thank you
why not fix this in asrodon.land ?

Because the website isnt supposed to be seen yet.

@elycheikhsmail
Copy link
Author

Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants