This commit is contained in:
		
							parent
							
								
									c1efe0a3a4
								
							
						
					
					
						commit
						c47addc973
					
				
					 4 changed files with 17 additions and 6 deletions
				
			
		| 
						 | 
					@ -52,9 +52,20 @@ export default class MiOS extends EventEmitter {
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private swRegistration: ServiceWorkerRegistration = null;
 | 
						private swRegistration: ServiceWorkerRegistration = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	constructor() {
 | 
						/**
 | 
				
			||||||
 | 
						 * Whether should register ServiceWorker
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						private shouldRegisterSw: boolean;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * MiOSインスタンスを作成します
 | 
				
			||||||
 | 
						 * @param shouldRegisterSw ServiceWorkerを登録するかどうか
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						constructor(shouldRegisterSw = false) {
 | 
				
			||||||
		super();
 | 
							super();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							this.shouldRegisterSw = shouldRegisterSw;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//#region BIND
 | 
							//#region BIND
 | 
				
			||||||
		this.log = this.log.bind(this);
 | 
							this.log = this.log.bind(this);
 | 
				
			||||||
		this.logInfo = this.logInfo.bind(this);
 | 
							this.logInfo = this.logInfo.bind(this);
 | 
				
			||||||
| 
						 | 
					@ -170,7 +181,7 @@ export default class MiOS extends EventEmitter {
 | 
				
			||||||
			//#region Post
 | 
								//#region Post
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// Init service worker
 | 
								// Init service worker
 | 
				
			||||||
			this.registerSw();
 | 
								if (this.shouldRegisterSw) this.registerSw();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			//#endregion
 | 
								//#endregion
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,7 +40,7 @@ init(async (mios: MiOS) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Start routing
 | 
						// Start routing
 | 
				
			||||||
	route(mios);
 | 
						route(mios);
 | 
				
			||||||
});
 | 
					}, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function registerNotifications(stream: HomeStreamManager) {
 | 
					function registerNotifications(stream: HomeStreamManager) {
 | 
				
			||||||
	if (stream == null) return;
 | 
						if (stream == null) return;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,8 +52,8 @@ if (localStorage.getItem('should-refresh') == 'true') {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MiOSを初期化してコールバックする
 | 
					// MiOSを初期化してコールバックする
 | 
				
			||||||
export default callback => {
 | 
					export default (callback, sw = false) => {
 | 
				
			||||||
	const mios = new MiOS();
 | 
						const mios = new MiOS(sw);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mios.init(() => {
 | 
						mios.init(() => {
 | 
				
			||||||
		// ミックスイン初期化
 | 
							// ミックスイン初期化
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,4 +19,4 @@ init((mios: MiOS) => {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Start routing
 | 
						// Start routing
 | 
				
			||||||
	route(mios);
 | 
						route(mios);
 | 
				
			||||||
});
 | 
					}, true);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue