Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
Vikas Burman authored and Vikas Burman committed May 13, 2019
1 parent 372988f commit e4d221a
Show file tree
Hide file tree
Showing 34 changed files with 667 additions and 305 deletions.
1 change: 1 addition & 0 deletions debug/client.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<body>
<script src="../dist/flair.js"></script>
<script type="text/javascript">
console.log(`${flair.info.name} - v${flair.info.version} loaded!`);
debugger;
</script>
</body>
Expand Down
1 change: 1 addition & 0 deletions debug/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const flair = require('../dist/flair.js');
console.log(`${flair.info.name} - v${flair.info.version} loaded!`);
debugger;


Expand Down
90 changes: 56 additions & 34 deletions dist/flair.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
*
* Assembly: flair.app
* File: ./flair.app.js
* Version: 0.6.7
* Sat, 11 May 2019 03:55:13 GMT
* Version: 0.6.37
* Mon, 13 May 2019 03:45:10 GMT
*
* (c) 2017-2019 Vikas Burman
* MIT
Expand All @@ -24,12 +24,9 @@
} else { // expose as global on window
root['flair.app'] = factory;
}
})(this, async function(__asmFile) {
})(this, async function(flair, __asmFile) {
'use strict';

// flair object
const flair = (typeof global !== 'undefined' ? require('flairjs') : (typeof WorkerGlobalScope !== 'undefined' ? WorkerGlobalScope.flair : window.flair));

// assembly closure init (start)
/* eslint-disable no-unused-vars */

Expand Down Expand Up @@ -58,7 +55,7 @@
AppDomain.loadPathOf('flair.app', __currentPath);

// settings of this assembly
let settings = JSON.parse('{"boot":{"load":[]},"di":{"container":{}},"client":{"view":{"el":"main","title":"","transition":""},"url":{"404":"/404","hashbang":false,"i18n":false,"home":"/"},"vue":{"components":[],"filters":[],"mixins":[],"directives":[],"plugins":[],"pluginOptions":{}},"i18n":{"enabled":true,"locale":"en","locales":[{"code":"en","name":"English","native":"English"}]},"routing":{"mounts":{"main":"/"},"main-options":[],"main-interceptors":[]}},"server":{"express":{"server-http":{"enable":false,"port":80,"timeout":-1},"server-https":{"enable":false,"port":443,"timeout":-1,"privateKey":"","publicCert":""}},"envVars":{"vars":[],"options":{"overwrite":true}},"routing":{"mounts":{"main":"/"},"main-appSettings":[],"main-middlewares":[],"main-interceptors":[],"main-resHeaders":[]}}}');
let settings = JSON.parse('{"host":"flair.app.ServerHost | flair.app.ClientHost","app":"flair.app.App","boot":{"load":[]},"di":{"container":{}},"client":{"view":{"el":"main","title":"","transition":""},"url":{"404":"/404","hashbang":false,"i18n":false,"home":"/"},"vue":{"components":[],"filters":[],"mixins":[],"directives":[],"plugins":[],"pluginOptions":{}},"i18n":{"enabled":true,"locale":"en","locales":[{"code":"en","name":"English","native":"English"}]},"routing":{"mounts":{"main":"/"},"main-options":[],"main-interceptors":[]}},"server":{"express":{"server-http":{"enable":false,"port":80,"timeout":-1},"server-https":{"enable":false,"port":443,"timeout":-1,"privateKey":"","publicCert":""}},"envVars":{"vars":[],"options":{"overwrite":true}},"routing":{"mounts":{"main":"/"},"main-appSettings":[],"main-middlewares":[],"main-interceptors":[],"main-resHeaders":[]}}}');
let settingsReader = flair.Port('settingsReader');
if (typeof settingsReader === 'function') {
let externalSettings = settingsReader('flair.app');
Expand Down Expand Up @@ -127,8 +124,6 @@

/**
* @name ready
* @arguments
* mount: object - mount object
*/
$$('virtual');
$$('async');
Expand Down Expand Up @@ -177,38 +172,68 @@
};

$$('override');
$$('sealed');
this.boot = async (base) => {
base();
AppDomain.host().error.add(this.onError); // host's errors are handled here
AppDomain.host().error.add(this.handleError); // host's errors are handled here
};

$$('virtual');
this.start = async () => {
// initialize view state
if (!env.isServer && !env.isWorker) {
const { ViewState } = ns('flair.ui');
new ViewState(); // this initializes the global view state store's persistance via this singleton object
}

// do more
await this.onStart();
};

$$('virtual');
$$('async');
this.onStart = noop;

$$('override');
$$('sealed');
this.ready = async () => {
// do more
await this.onReady();
};

$$('virtual');
$$('async');
this.onReady = noop;

this.stop = async () => {
// clear view state
if (!env.isServer && !env.isWorker) {
const { ViewState } = ns('flair.ui');
new ViewState().clear();
}

// do more
await this.onStop();
};

$$('virtual');
this.onError = (e) => {
throw Exception.OperationFailed(e.error, this.onError);
$$('async');
this.onStop = noop;

$$('private');
this.handleError = (e) => {
// do more
this.onError(e.error);
};

$$('virtual');
this.onError = (err) => {
throw Exception.OperationFailed(err, this.onError);
};

$$('override');
this.dispose = (base) => {
base();
AppDomain.host().error.remove(this.onError); // remove error handler
AppDomain.host().error.remove(this.handleError); // remove error handler
};
});

Expand All @@ -223,23 +248,13 @@
*/
$$('ns', 'flair.app');
Class('Host', Bootware, [IDisposable], function() {
$$('privateSet');
this.isStarted = false;

$$('virtual');
this.start = async () => {
this.isStarted = true;
};
$$('async');
this.start = noop;

$$('virtual');
this.stop = async () => {
this.isStarted = false;
};

this.restart = async () => {
await this.stop();
await this.start();
};
$$('async');
this.stop = noop;

this.error = event((err) => {
return { error: err };
Expand Down Expand Up @@ -734,8 +749,8 @@
}
};
const boot = async () => {
const Host = await include('flair.app.ServerHost | flair.app.ClientHost');
const App = await include('flair.app.App');
const Host = await include(settings.host);
const App = await include(settings.app);

// set host
if (!env.isWorker) {
Expand Down Expand Up @@ -1608,7 +1623,7 @@
this.boot = async (base) => {
base();

if (settings.server.nsenvVars.vars.length > 0) {
if (settings.server.envVars.vars.length > 0) {
const nodeEnv = await include('node-env-file | x');

if (nodeEnv) {
Expand Down Expand Up @@ -2479,12 +2494,19 @@

// clear assembly being loaded
AppDomain.context.current().currentAssemblyBeingLoaded('');

// register assembly definition object
AppDomain.registerAdo('{"name":"flair.app","file":"./flair.app{.min}.js","mainAssembly":"flair","desc":"True Object Oriented JavaScript","title":"Flair.js","version":"0.6.7","lupdate":"Sat, 11 May 2019 03:55:13 GMT","builder":{"name":"flairBuild","version":"1","format":"fasm","formatVersion":"1","contains":["init","func","type","vars","reso","asst","rout","sreg"]},"copyright":"(c) 2017-2019 Vikas Burman","license":"MIT","types":["flair.app.Bootware","flair.app.Handler","flair.app.App","flair.app.Host","flair.ui.vue.VueComponentMembers","flair.api.RestHandler","flair.api.RestInterceptor","flair.app.BootEngine","flair.app.ClientHost","flair.app.ServerHost","flair.boot.ClientRouter","flair.boot.DIContainer","flair.boot.Middlewares","flair.boot.NodeEnv","flair.boot.ResHeaders","flair.boot.ServerRouter","flair.ui.ViewHandler","flair.ui.ViewInterceptor","flair.ui.ViewState","flair.ui.ViewTransition","flair.ui.vue.VueComponent","flair.ui.vue.VueDirective","flair.ui.vue.VueFilter","flair.ui.vue.VueLayout","flair.ui.vue.VueMixin","flair.ui.vue.VuePlugin","flair.ui.vue.VueSetup","flair.ui.vue.VueView"],"resources":[],"assets":[],"routes":[{"name":"flair.ui.vue.test2","mount":"main","index":101,"verbs":[],"path":"test/:id","handler":"abc.xyz.Test"},{"name":"flair.ui.vue.exit2","mount":"main","index":103,"verbs":[],"path":"exit","handler":"abc.xyz.Exit"}]}');

AppDomain.registerAdo('{"name":"flair.app","file":"./flair.app{.min}.js","mainAssembly":"flair","desc":"True Object Oriented JavaScript","title":"Flair.js","version":"0.6.37","lupdate":"Mon, 13 May 2019 03:45:10 GMT","builder":{"name":"flairBuild","version":"1","format":"fasm","formatVersion":"1","contains":["init","func","type","vars","reso","asst","rout","sreg"]},"copyright":"(c) 2017-2019 Vikas Burman","license":"MIT","types":["flair.app.Bootware","flair.app.Handler","flair.app.App","flair.app.Host","flair.ui.vue.VueComponentMembers","flair.api.RestHandler","flair.api.RestInterceptor","flair.app.BootEngine","flair.app.ClientHost","flair.app.ServerHost","flair.boot.ClientRouter","flair.boot.DIContainer","flair.boot.Middlewares","flair.boot.NodeEnv","flair.boot.ResHeaders","flair.boot.ServerRouter","flair.ui.ViewHandler","flair.ui.ViewInterceptor","flair.ui.ViewState","flair.ui.ViewTransition","flair.ui.vue.VueComponent","flair.ui.vue.VueDirective","flair.ui.vue.VueFilter","flair.ui.vue.VueLayout","flair.ui.vue.VueMixin","flair.ui.vue.VuePlugin","flair.ui.vue.VueSetup","flair.ui.vue.VueView"],"resources":[],"assets":[],"routes":[]}');
// assembly load complete
if (typeof onLoadComplete === 'function') {
onLoadComplete(); // eslint-disable-line no-undef
}

// return settings and config
return Object.freeze({
name: 'flair.app',
settings: settings,
config: config
});
});
6 changes: 3 additions & 3 deletions dist/flair.app.min.js

Large diffs are not rendered by default.

Binary file modified dist/flair.app.min.js.gz
Binary file not shown.
Loading

0 comments on commit e4d221a

Please sign in to comment.