本文整理匯總了TypeScript中electron-json-storage.set函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript set函數的具體用法?TypeScript set怎麽用?TypeScript set使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了set函數的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
storage.get('queries', function(error, queries) {
if (error) {
console.error(error);
} else {
if (_.contains(_.map(queries, (q: QueryEntry) => { return q.name; }), $name.val())) {
pushResponse($resp, 'Key already exists.');
} else {
if (_.isEmpty(queries)) {
queries = [];
}
queries.push({
name: $name.val(),
collection: $collection.val(),
query: $query.val()
});
storage.set('queries', queries, function(error) {
if (error) {
console.error(error);
} else {
pushResponse($resp, 'Entry added successfully.');
}
});
}
}
});
示例2:
.then(result => {
storage.set(TWITTER_CREDENTIALS_KEY, result, (err) => {
if (err) {
reject(err)
}
resolve(result as TwitterCredentials)
})
})
示例3: function
$('body').on('click', '#mailgun-dialog .button#save', function(event) {
api_key = $('#mailgun-dialog input[name="API Key"]').val();
domain = $('#mailgun-dialog input[name="Domain"]').val();
storage.set('mailgun', { api_key: api_key, domain: domain}, function(error) {
if (error) {
console.error(error);
}
});
close();
});
示例4: function
storage.get('templates', function(error, templates) {
if (_.isEmpty(templates)) {
templates = [];
}
if (! _.contains(templates, fileNames[0])) {
templates.push(fileNames[0]);
storage.set('templates', templates, function(error) {
if (error) {
console.error(error);
}
});
}
});
示例5: function
storage.get('dbs', function(error, dbs) {
if (error) {
console.error(error);
} else {
dbs = _.filter(dbs, (db: DBEntry) => { return db.name !== target; });
storage.set('dbs', dbs, function(error) {
if (error) {
console.error(error);
} else {
$('#db-dialog .db-list li[name="' + target + '"]').remove();
pushResponse($resp, 'Removed \'' + target + '\' successfully.');
}
});
}
});
示例6: Promise
return new Promise((resolve, reject) => {
set(CONFIG, config, (error: any) => error ? reject(error) : resolve(config));
});
示例7:
.map(update => {
storage.set(STATE_PROP, update.state)
return { type: SAVER_NO_OP }
})