uBlock/src/js/xal.js

68 lines
2.1 KiB
JavaScript
Raw Normal View History

/*******************************************************************************
µBlock - a Chromium browser extension to block requests.
Copyright (C) 2014 Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
2014-10-19 16:44:09 +02:00
/* global µBlock */
'use strict';
/******************************************************************************/
µBlock.XAL = (function(){
/******************************************************************************/
var exports = {};
2014-10-07 16:46:10 +02:00
var noopFunc = function(){};
2014-09-28 20:38:17 +02:00
/******************************************************************************/
2014-10-11 22:44:56 +02:00
exports.keyvalSetOne = function(key, val, callback) {
2014-10-06 20:02:44 +02:00
var bin = {};
bin[key] = val;
vAPI.storage.set(bin, callback || noopFunc);
2014-10-06 20:02:44 +02:00
};
/******************************************************************************/
2014-10-11 22:44:56 +02:00
exports.keyvalSetMany = function(dict, callback) {
vAPI.storage.set(dict, callback || noopFunc);
2014-10-07 14:59:35 +02:00
};
/******************************************************************************/
exports.keyvalRemoveOne = function(key, callback) {
vAPI.storage.remove(key, callback || noopFunc);
};
/******************************************************************************/
2014-10-07 14:59:35 +02:00
exports.keyvalRemoveAll = function(callback) {
vAPI.storage.clear(callback || noopFunc);
2014-10-07 14:59:35 +02:00
};
/******************************************************************************/
return exports;
/******************************************************************************/
})();