mirror of
https://github.com/qlik-oss/nebula.js.git
synced 2025-12-19 17:58:43 -05:00
26 lines
672 B
JavaScript
26 lines
672 B
JavaScript
export default function connect() {
|
|
const loadSchema = () => fetch('/node_modules/enigma.js/schemas/3.2.json').then((response) => response.json());
|
|
|
|
const createConnection = () =>
|
|
loadSchema().then((schema) =>
|
|
window.enigma
|
|
.create({
|
|
schema,
|
|
url: `ws://${window.location.hostname || 'localhost'}:9076/app/${Date.now()}`,
|
|
})
|
|
.open()
|
|
.then((qix) => qix.createSessionApp())
|
|
);
|
|
|
|
return createConnection().then((app) =>
|
|
app
|
|
.setScript(
|
|
`
|
|
Characters:
|
|
Load Chr(RecNo()+Ord('A')-1) as Alpha, RecNo() as Num autogenerate 5;
|
|
`
|
|
)
|
|
.then(() => app.doReload().then(() => app))
|
|
);
|
|
}
|