@smartface/contx
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -12,3 +12,3 @@ import Actor from '../core/Actor'; | ||
asStyler(): () => any; | ||
asStyler(): (classNames?: string) => any; | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -136,2 +136,7 @@ "use strict"; | ||
var id = themeContext.getLastActorID(); | ||
var currentTheme = themesCollection.find(function (theme) { return theme.isDefault(); }); | ||
var styles = currentTheme.asStyler(); | ||
/** | ||
* @param {object | null | string} action | ||
*/ | ||
return function themeContextDispatch(action) { | ||
@@ -143,5 +148,12 @@ if (action === null) { | ||
} | ||
else { | ||
else if (typeof action === 'object' && typeof action.type === "string") { | ||
themeContext.dispatch(action); | ||
if (action.type === "changeTheme") { | ||
currentTheme = themesCollection.find(function (theme) { return theme.isDefault(); }); | ||
styles = currentTheme.asStyler(); | ||
} | ||
} | ||
else if (typeof action === 'string' && currentTheme) { | ||
return styles(action)(); | ||
} | ||
}; | ||
@@ -148,0 +160,0 @@ }; |
{ | ||
"name": "@smartface/contx", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Context Manager", | ||
@@ -48,3 +48,3 @@ "scripts": { | ||
"jase": "^1.2.0", | ||
"jsdoc": "^3.5.5", | ||
"jsdoc": "^3.6.7", | ||
"jsdoc-babel": "^0.3.0", | ||
@@ -51,0 +51,0 @@ "jsdoc-to-markdown": "^3.0.2", |
@@ -12,3 +12,3 @@ import Actor from '../core/Actor'; | ||
asStyler(): () => any; | ||
asStyler(): (classNames?: string) => any; | ||
} | ||
@@ -15,0 +15,0 @@ |
@@ -130,3 +130,7 @@ import { INIT_CONTEXT_ACTION_TYPE } from "../core/constants"; | ||
const id = themeContext.getLastActorID(); | ||
let currentTheme = themesCollection.find(theme => theme.isDefault()); | ||
let styles = currentTheme.asStyler(); | ||
/** | ||
* @param {object | null | string} action | ||
*/ | ||
return function themeContextDispatch(action) { | ||
@@ -137,4 +141,10 @@ if (action === null) { | ||
}, id); | ||
} else { | ||
} else if(typeof action === 'object' && typeof action.type === "string") { | ||
themeContext.dispatch(action); | ||
if(action.type === "changeTheme") { | ||
currentTheme = themesCollection.find(theme => theme.isDefault()); | ||
styles = currentTheme.asStyler(); | ||
} | ||
} else if(typeof action === 'string' && currentTheme) { | ||
return styles(action)(); | ||
} | ||
@@ -141,0 +151,0 @@ }; |
Sorry, the diff of this file is not supported yet
228140
4325