Removing test scrolling; Icon library to prevent cache lag

This commit is contained in:
James Barnsley
2018-02-18 21:39:03 +13:00
parent 7d1819e9bd
commit b795d9647b
8 changed files with 104 additions and 34 deletions

View File

@ -105,6 +105,38 @@ export function set(data){
}
}
export function getIcon(name){
return (dispatch, getState) => {
var config = {
method: 'GET',
timeout: 15000,
url: 'assets/icons/'+name+'.svg'
}
$.ajax(config).then(
response => {
dispatch({
type: 'ICON_LOADED',
key: name,
icon: new XMLSerializer().serializeToString(response)
})
},
(xhr, status, error) => {
dispatch(
handleException(
'Could not load '+name+' icon',
{
config: config,
xhr: xhr,
status: status,
error: error
}
)
);
}
)
}
}
/**

View File

@ -24,6 +24,11 @@ export default function reducer(ui = {}, action){
case 'SET_SELECTED_TRACKS':
return Object.assign({}, ui, { selected_tracks : Object.assign([],action.keys) })
case 'ICON_LOADED':
var icons = Object.assign({}, ui.icons);
icons[action.key] = action.icon;
return Object.assign({}, ui, {icons : icons});
/**
* Context menu