Comparing version 0.0.5 to 0.0.6
import { IState, ICursor } from './store'; | ||
export declare let bootstrap: (renderCallback: () => void) => void; | ||
export declare type debugCallbackType = (message: string, params?: any) => void; | ||
export declare let bootstrap: (renderCallback: () => void, debugCallback?: (message: string, params?: any) => void) => void; | ||
export interface IAction<T> { | ||
@@ -4,0 +5,0 @@ (param?: T): void; |
var store_1 = require('./store'); | ||
var render = null; | ||
exports.bootstrap = function (renderCallback) { | ||
var debug = undefined; | ||
exports.bootstrap = function (renderCallback, debugCallback) { | ||
if (debugCallback === void 0) { debugCallback = function (m, p) { }; } | ||
render = renderCallback; | ||
debug = debugCallback; | ||
debug('Action factory has been initialized.'); | ||
}; | ||
@@ -9,4 +13,6 @@ exports.createAction = function (cursor, handler) { | ||
validateRenderCallback(); | ||
if (changeState(cursor, handler, params)) | ||
if (changeState(cursor, handler, params)) { | ||
render(); | ||
debug('Rendering invoked...'); | ||
} | ||
}); | ||
@@ -41,3 +47,4 @@ }; | ||
store_1.setState(cursor, newState); | ||
debug('Current state: ', newState); | ||
return true; | ||
} |
import { setState, getState, IState, ICursor } from './store'; | ||
let render: () => void = null; | ||
let debug: debugCallbackType = undefined; | ||
export let bootstrap = (renderCallback: () => void) => { | ||
export type debugCallbackType = (message: string, params?: any) => void | ||
export let bootstrap = (renderCallback: () => void, debugCallback: debugCallbackType = (m, p) => {}) => { | ||
render = renderCallback; | ||
debug = debugCallback; | ||
debug('Action factory has been initialized.'); | ||
}; | ||
@@ -17,4 +22,6 @@ | ||
validateRenderCallback(); | ||
if (changeState(cursor, handler, params)) | ||
if (changeState(cursor, handler, params)) { | ||
render(); | ||
debug('Rendering invoked...'); | ||
} | ||
}); | ||
@@ -55,3 +62,4 @@ } | ||
setState(cursor, newState); | ||
debug('Current state: ', newState); | ||
return true; | ||
} |
@@ -5,2 +5,2 @@ import { IState } from './store'; | ||
export * from './helpers'; | ||
export declare let bootstrap: (defaultState: IState, renderCallback: () => void, subStateSeparator?: string) => void; | ||
export declare let bootstrap: (defaultState: IState, renderCallback: () => void, debugCallback?: (message: string, params?: any) => void, subStateSeparator?: string) => void; |
@@ -9,6 +9,7 @@ function __export(m) { | ||
__export(require('./helpers')); | ||
exports.bootstrap = function (defaultState, renderCallback, subStateSeparator) { | ||
exports.bootstrap = function (defaultState, renderCallback, debugCallback, subStateSeparator) { | ||
if (debugCallback === void 0) { debugCallback = undefined; } | ||
if (subStateSeparator === void 0) { subStateSeparator = '.'; } | ||
store_1.bootstrap(defaultState, subStateSeparator); | ||
actionFactory_1.bootstrap(renderCallback); | ||
actionFactory_1.bootstrap(renderCallback, function (message, params) { debugCallback && debugCallback("fun-model -> " + message, params); }); | ||
}; |
import { IState } from './store'; | ||
import { bootstrap as storeBootstrap } from './store'; | ||
import { bootstrap as actionFactoryBootstrap } from './actionFactory'; | ||
import { bootstrap as actionFactoryBootstrap, debugCallbackType } from './actionFactory'; | ||
@@ -9,5 +9,5 @@ export * from './store'; | ||
export let bootstrap = (defaultState: IState, renderCallback: () => void, subStateSeparator: string = '.') => { | ||
export let bootstrap = (defaultState: IState, renderCallback: () => void, debugCallback: debugCallbackType = undefined, subStateSeparator: string = '.') => { | ||
storeBootstrap(defaultState, subStateSeparator); | ||
actionFactoryBootstrap(renderCallback); | ||
actionFactoryBootstrap(renderCallback, (message, params) => { debugCallback && debugCallback(`fun-model -> ${message}`, params) }); | ||
}; |
{ | ||
"name": "fun-model", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "fun-model is pure functional implementation of FLUX architecture.", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17330
281