I try to build a desktop application using Angular and Neutralinojs.
According to https://neutralino.js.org/docs/getting-started/using-frontend-libraries/ I try to use the @neutralinojs/lib
and just including the __neutralino_globals.js
file in my index.html
.
In the main.ts
I have the following code:
import { bootstrapApplication } from '@angular/platform-browser';
import { HttpClientModule } from '@angular/common/http';
import { AppComponent } from './app/app.component';
import * as neutralinojs from "@neutralinojs/lib";
declare global {
const NL_MODE: String;
}
if (typeof NL_MODE !== 'undefined' && NL_MODE == "window") {
Neutralino.init();
Neutralino.events.on("windowClose", () => {
Neutralino.app.exit();
});
}
bootstrapApplication(AppComponent, {
providers: [
importProvidersFrom(HttpClientModule)
]
});
Unfortunately I get the following error in my Neutralino application:
Uncaught ReferenceError: Neutralino is not defined
at 103 (main.472a06f9fbfbf5cf.js:1:555101)
at a (runtime.7774ff81d752b5d3.js:1:127)
at main.472a06f9fbfbf5cf.js:1:555301
at l (runtime.7774ff81d752b5d3.js:1:683)
at main.472a06f9fbfbf5cf.js:1:72
As soon as I add <script src="assets/neutralino.js"></script>
the script it works as expected.
Is there the documentation wrong or did I mixed up several different styles?
Versions:
- neu CLI: v11.0.1
- Neutralinojs binaries: v5.1.0
- Neutralinojs client: v5.1.0
- Angular 16.2.0