Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$.getJSON("/api/plugins/" + this.props.params.slug, function(data) {
this.setState(data);
// Save in localStorage that this plugin has been visited.
if (store.enabled) {
var pluginStore = store.get("plugin-" + data.slug) || {};
pluginStore.hasVisited = true;
store.set("plugin-" + data.slug, pluginStore);
}
}.bind(this));
},
$.getJSON("/api/plugins/" + this.props.params.slug, function(data) {
this.setState(data);
// Save in localStorage that this plugin has been visited.
if (store.enabled) {
var pluginStore = store.get("plugin-" + data.slug) || {};
pluginStore.hasVisited = true;
store.set("plugin-" + data.slug, pluginStore);
}
}.bind(this));
},
private static get(namespace: string, key: string): T {
console.log('get', key)
if (Settings.cache[namespace].hasOwnProperty(key) == false) {
let storedValue = StoreJS.get(namespace + '_' + key);
if (storedValue == undefined) {
storedValue = DEFAULTS[key];
}
Settings.cache[namespace][key] = storedValue;
}
return Settings.cache[namespace][key];
}
function request(error, callback) {
$.ajax({
crossDomain: true,
url: url + 'error/' + error,
type: 'post',
data: JSON.stringify({user: store.get('username')})
})
.error(jqError)
.done(callback);
}
get: function(){
this.todos = store.get('todos') || [];
this.trigger({
data: this.todos
});
},
toggle: function() {
if (store.get('sidebar')) {
store.remove('sidebar');
this.settings.sidebar = false;
} else {
store.set('sidebar', true);
this.settings.sidebar = store.get('sidebar');
}
this.trigger(this.settings);
}
});
function getCachedPlace() {
var cached = store.get( constants.CACHE_KEY_MY_PLACE );
if ( cached ) {
return cached;
}
return {};
}
initialize : function()
{
this.grids = store.get('grids');
if (! this.grids) {
this.grids = [this.getInitialGrid()];
}
this.selectedGrid = 0;
this.bindActions(
'ADD_GRID', 'onAddGrid',
'ADD_TASK', 'onAddTask',
'TOGGLE_COMPLETED', 'onToggleCompleted',
'REMOVE_TASK', 'onRemoveTask',
'SELECT_GRID', 'onSelectGrid',
'DELETE_GRID', 'onDeleteGrid'
);
},
getInitialState: function() {
var pluginId = this.props.plugin.slug;
var pluginStore = pluginId && store.enabled &&
store.get("plugin-" + pluginId);
return {
hasVisited: pluginStore && pluginStore.hasVisited
};
},
getInitialState: function() {
var pluginId = this.props.plugin.slug;
var pluginStore = pluginId && store.enabled &&
store.get("plugin-" + pluginId);
return {
hasVisited: pluginStore && pluginStore.hasVisited
};
},