Comparing version 0.6.0 to 0.7.0
@@ -98,4 +98,26 @@ /** | ||
function serializeForm( form ) | ||
{ | ||
var object = {}; | ||
new FormData( form ).forEach(( value, key) => | ||
{ | ||
// Reflect.has in favor of: object.hasOwnProperty(key) | ||
if( !Reflect.has( object, key ) ) | ||
{ | ||
object[ key ] = value; | ||
return; | ||
} | ||
if( !Array.isArray( object[ key ] ) ) | ||
{ | ||
object[ key ] = [ object[ key ] ]; | ||
} | ||
object[ key ].push( value ); | ||
}); | ||
return object; | ||
} | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
@@ -1121,4 +1143,3 @@ // start: private methods | ||
// Global app pool | ||
const apps = {}; | ||
const VERSION = '0.7.0'; | ||
@@ -1151,2 +1172,21 @@ const DEFAULT_PROPS = { | ||
{ | ||
static POOL = {}; | ||
static get( uid = null ) | ||
{ | ||
if ( uid && App.POOL.hasOwnProperty( uid ) ) | ||
{ | ||
return App.POOL[ uid ]; | ||
} | ||
else if ( null === uid && Object.keys( App.POOL ).length > 0 ) | ||
{ | ||
return App.POOL[ Object.keys( App.POOL )[ 0 ] ]; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
constructor( props = {}, settings = {} ) | ||
@@ -1182,7 +1222,8 @@ { | ||
// Add app to global app pool | ||
apps[ this.uid ] = this; | ||
//apps[ this.uid ] = this; | ||
App.POOL[ this.uid ] = this; | ||
if ( true === this.settings.sayHello && console ) | ||
{ | ||
console && console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" ); | ||
console && console.log( "%c»InfrontJS« Version " + VERSION, "font-family: monospace sans-serif; background-color: black; color: white;" ); | ||
} | ||
@@ -1228,47 +1269,6 @@ } | ||
{ | ||
// @todo Implement logic, set innerHTML to zero ... etc | ||
} | ||
} | ||
function getApp( uid = null ) | ||
{ | ||
if ( uid && apps.hasOwnProperty( uid ) ) | ||
{ | ||
return apps[ uid ]; | ||
} | ||
else if ( null === uid && Object.keys( apps ) > 0 ) | ||
{ | ||
return apps[ Object.keys( apps )[ 0 ] ]; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
async function destroyApp( appToDestroy ) | ||
{ | ||
let idx = -1; | ||
if ( appToDestroy instanceof App ) | ||
{ | ||
idx = apps.findIndex( app => app.uid === appToDestroy.uid ); | ||
} | ||
else | ||
{ | ||
let appUid = '' + appToDestroy; | ||
idx = apps.findIndex( app => app.uid === appUid ); | ||
} | ||
if ( -1 < idx ) | ||
{ | ||
await apps[ idx ].destroy(); | ||
apps.splice( idx, 1 ); | ||
} | ||
else | ||
{ | ||
console && console.warn( `App with UID ${uid} not found.` ); | ||
} | ||
} | ||
const version = "0.6.0"; | ||
export { Api, App, L18n, PropertyObject, Router, State, StateManager, TemplateManager, ViewManager, createUid, destroyApp, getApp, isClass, isClassChildOf, isPlainObject, trim, version }; | ||
export { Api, App, L18n, PropertyObject, Router, State, StateManager, TemplateManager, ViewManager, createUid, isClass, isClassChildOf, isPlainObject, isString, serializeForm, trim }; |
@@ -104,4 +104,26 @@ (function (global, factory) { | ||
function serializeForm( form ) | ||
{ | ||
var object = {}; | ||
new FormData( form ).forEach(( value, key) => | ||
{ | ||
// Reflect.has in favor of: object.hasOwnProperty(key) | ||
if( !Reflect.has( object, key ) ) | ||
{ | ||
object[ key ] = value; | ||
return; | ||
} | ||
if( !Array.isArray( object[ key ] ) ) | ||
{ | ||
object[ key ] = [ object[ key ] ]; | ||
} | ||
object[ key ].push( value ); | ||
}); | ||
return object; | ||
} | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
@@ -1127,4 +1149,3 @@ // start: private methods | ||
// Global app pool | ||
const apps = {}; | ||
const VERSION = '0.7.0'; | ||
@@ -1157,2 +1178,21 @@ const DEFAULT_PROPS = { | ||
{ | ||
static POOL = {}; | ||
static get( uid = null ) | ||
{ | ||
if ( uid && App.POOL.hasOwnProperty( uid ) ) | ||
{ | ||
return App.POOL[ uid ]; | ||
} | ||
else if ( null === uid && Object.keys( App.POOL ).length > 0 ) | ||
{ | ||
return App.POOL[ Object.keys( App.POOL )[ 0 ] ]; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
constructor( props = {}, settings = {} ) | ||
@@ -1188,7 +1228,8 @@ { | ||
// Add app to global app pool | ||
apps[ this.uid ] = this; | ||
//apps[ this.uid ] = this; | ||
App.POOL[ this.uid ] = this; | ||
if ( true === this.settings.sayHello && console ) | ||
{ | ||
console && console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" ); | ||
console && console.log( "%c»InfrontJS« Version " + VERSION, "font-family: monospace sans-serif; background-color: black; color: white;" ); | ||
} | ||
@@ -1234,47 +1275,6 @@ } | ||
{ | ||
// @todo Implement logic, set innerHTML to zero ... etc | ||
} | ||
} | ||
function getApp( uid = null ) | ||
{ | ||
if ( uid && apps.hasOwnProperty( uid ) ) | ||
{ | ||
return apps[ uid ]; | ||
} | ||
else if ( null === uid && Object.keys( apps ) > 0 ) | ||
{ | ||
return apps[ Object.keys( apps )[ 0 ] ]; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
async function destroyApp( appToDestroy ) | ||
{ | ||
let idx = -1; | ||
if ( appToDestroy instanceof App ) | ||
{ | ||
idx = apps.findIndex( app => app.uid === appToDestroy.uid ); | ||
} | ||
else | ||
{ | ||
let appUid = '' + appToDestroy; | ||
idx = apps.findIndex( app => app.uid === appUid ); | ||
} | ||
if ( -1 < idx ) | ||
{ | ||
await apps[ idx ].destroy(); | ||
apps.splice( idx, 1 ); | ||
} | ||
else | ||
{ | ||
console && console.warn( `App with UID ${uid} not found.` ); | ||
} | ||
} | ||
const version = "0.6.0"; | ||
exports.Api = Api; | ||
@@ -1290,9 +1290,8 @@ exports.App = App; | ||
exports.createUid = createUid; | ||
exports.destroyApp = destroyApp; | ||
exports.getApp = getApp; | ||
exports.isClass = isClass; | ||
exports.isClassChildOf = isClassChildOf; | ||
exports.isPlainObject = isPlainObject; | ||
exports.isString = isString; | ||
exports.serializeForm = serializeForm; | ||
exports.trim = trim; | ||
exports.version = version; | ||
@@ -1299,0 +1298,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "infrontjs", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"description": "The progressive frontend framework.", | ||
@@ -33,4 +33,3 @@ "main": "src/IF.js", | ||
"dependencies": { | ||
"infrontjs": "^0.3.0" | ||
} | ||
} |
import { PropertyObject } from "./PropertyObject.js"; | ||
import { createUid, isString } from "../util/Functions.js"; | ||
import { version } from "../IF.js"; | ||
@@ -11,5 +10,5 @@ import { Router } from "./Router.js"; | ||
// Global app pool | ||
const apps = {}; | ||
const VERSION = '0.7.0'; | ||
const DEFAULT_PROPS = { | ||
@@ -41,2 +40,21 @@ "uid" : null, | ||
{ | ||
static POOL = {}; | ||
static get( uid = null ) | ||
{ | ||
if ( uid && App.POOL.hasOwnProperty( uid ) ) | ||
{ | ||
return App.POOL[ uid ]; | ||
} | ||
else if ( null === uid && Object.keys( App.POOL ).length > 0 ) | ||
{ | ||
return App.POOL[ Object.keys( App.POOL )[ 0 ] ]; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
constructor( props = {}, settings = {} ) | ||
@@ -72,7 +90,8 @@ { | ||
// Add app to global app pool | ||
apps[ this.uid ] = this; | ||
//apps[ this.uid ] = this; | ||
App.POOL[ this.uid ] = this; | ||
if ( true === this.settings.sayHello && console ) | ||
{ | ||
console && console.log( "%c»InfrontJS« Version " + version, "font-family: monospace sans-serif; background-color: black; color: white;" ); | ||
console && console.log( "%c»InfrontJS« Version " + VERSION, "font-family: monospace sans-serif; background-color: black; color: white;" ); | ||
} | ||
@@ -118,45 +137,6 @@ } | ||
{ | ||
// @todo Implement logic, set innerHTML to zero ... etc | ||
} | ||
} | ||
function getApp( uid = null ) | ||
{ | ||
if ( uid && apps.hasOwnProperty( uid ) ) | ||
{ | ||
return apps[ uid ]; | ||
} | ||
else if ( null === uid && Object.keys( apps ) > 0 ) | ||
{ | ||
return apps[ Object.keys( apps )[ 0 ] ]; | ||
} | ||
else | ||
{ | ||
return null; | ||
} | ||
} | ||
async function destroyApp( appToDestroy ) | ||
{ | ||
let idx = -1; | ||
if ( appToDestroy instanceof App ) | ||
{ | ||
idx = apps.findIndex( app => app.uid === appToDestroy.uid ); | ||
} | ||
else | ||
{ | ||
let appUid = '' + appToDestroy; | ||
idx = apps.findIndex( app => app.uid === appUid ); | ||
} | ||
if ( -1 < idx ) | ||
{ | ||
await apps[ idx ].destroy(); | ||
apps.splice( idx, 1 ); | ||
} | ||
else | ||
{ | ||
console && console.warn( `App with UID ${uid} not found.` ); | ||
} | ||
} | ||
export { App, getApp, destroyApp }; | ||
export { App }; |
@@ -1,7 +0,4 @@ | ||
export const version = "0.6.0"; | ||
// Classes | ||
export { Api } from "./core/Api.js"; | ||
export { App, destroyApp, getApp } from "./core/App.js"; | ||
export { App } from "./core/App.js"; | ||
export { L18n } from "./core/L18n.js"; | ||
@@ -16,2 +13,2 @@ export { PropertyObject } from "./core/PropertyObject.js"; | ||
// global functions | ||
export { trim, createUid, isPlainObject, isClass, isClassChildOf } from "./util/Functions.js"; | ||
export { trim, createUid, isPlainObject, isClass, isClassChildOf, isString, serializeForm } from "./util/Functions.js"; |
@@ -98,4 +98,26 @@ /** | ||
function serializeForm( form ) | ||
{ | ||
var object = {}; | ||
new FormData( form ).forEach(( value, key) => | ||
{ | ||
// Reflect.has in favor of: object.hasOwnProperty(key) | ||
if( !Reflect.has( object, key ) ) | ||
{ | ||
object[ key ] = value; | ||
return; | ||
} | ||
if( !Array.isArray( object[ key ] ) ) | ||
{ | ||
object[ key ] = [ object[ key ] ]; | ||
} | ||
object[ key ].push( value ); | ||
}); | ||
return object; | ||
} | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
@@ -136,2 +158,2 @@ // start: private methods | ||
export { trim, createUid, isPlainObject, isString, isClass, isClassChildOf }; | ||
export { trim, createUid, isPlainObject, isString, isClass, isClassChildOf,serializeForm }; |
118917
0
3572
- Removedinfrontjs@^0.3.0
- Removedinfrontjs@0.3.0(transitive)