mirror of
				https://github.com/hyperion-project/hyperion.ng.git
				synced 2025-03-01 10:33:28 +00:00 
			
		
		
		
	* Initial WebUI with sample functions * Changed folder structure * Light Reset Button and Translation fixing in Links * Indentation fixed * Reorganized menu and new function for setting effects * Styling fix
		
			
				
	
	
		
			38 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| /*global define, chrome */
 | |
| define(['api/LocalStorage'], function (LocalStorage) {
 | |
|     'use strict';
 | |
|     return LocalStorage.subclass(/** @lends ChromeLocalStorage.prototype */{
 | |
| 
 | |
|         /**
 | |
|          * @class ChromeLocalStorage
 | |
|          * @classdesc Chrome's persistent storage
 | |
|          * @constructs
 | |
|          * @extends LocalStorage
 | |
|          */
 | |
|         constructor: function () {
 | |
|         },
 | |
| 
 | |
|         get: function () {
 | |
|             chrome.storage.local.get('data', function (entry) {
 | |
|                 if (chrome.runtime.lastError) {
 | |
|                     this.emit('error', chrome.runtime.lastError.message);
 | |
|                 } else {
 | |
|                     this.emit('got', entry.data);
 | |
|                 }
 | |
|             }.bind(this));
 | |
|         },
 | |
| 
 | |
|         set: function (data) {
 | |
|             var entry = {};
 | |
|             entry.data = data;
 | |
|             chrome.storage.local.set(entry, function () {
 | |
|                 if (chrome.runtime.lastError) {
 | |
|                     this.emit('error', chrome.runtime.lastError.message);
 | |
|                 } else {
 | |
|                     this.emit('set');
 | |
|                 }
 | |
|             }.bind(this));
 | |
|         }
 | |
|     });
 | |
| });
 |