OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 574 } |
575 }; | 575 }; |
576 } | 576 } |
577 | 577 |
578 return ext.onMessage._dispatch( | 578 return ext.onMessage._dispatch( |
579 message, sender, sendResponse | 579 message, sender, sendResponse |
580 ).includes(true); | 580 ).includes(true); |
581 }); | 581 }); |
582 | 582 |
583 | 583 |
584 /* Storage */ | |
585 | |
586 ext.storage = { | |
587 get(keys, callback) | |
588 { | |
589 browser.storage.local.get(keys, callback); | |
590 }, | |
591 set(key, value, callback) | |
592 { | |
593 let items = {}; | |
594 items[key] = value; | |
595 browser.storage.local.set(items, callback); | |
596 }, | |
597 remove(key, callback) | |
598 { | |
599 browser.storage.local.remove(key, callback); | |
600 }, | |
601 onChanged: browser.storage.onChanged | |
602 }; | |
603 | |
604 /* Windows */ | 584 /* Windows */ |
605 ext.windows = { | 585 ext.windows = { |
606 create(createData, callback) | 586 create(createData, callback) |
607 { | 587 { |
608 browser.windows.create(createData, createdWindow => | 588 browser.windows.create(createData, createdWindow => |
609 { | 589 { |
610 afterTabLoaded(callback)(createdWindow.tabs[0]); | 590 afterTabLoaded(callback)(createdWindow.tabs[0]); |
611 }); | 591 }); |
612 } | 592 } |
613 }; | 593 }; |
614 } | 594 } |
OLD | NEW |