| // Copyright (c) 2000-2017 Ericsson Telecom AB // |
| // All rights reserved. This program and the accompanying materials are made available under the // |
| // terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at // |
| // http://www.eclipse.org/legal/epl-v10.html // |
| /////////////////////////////////////////////////////////////////////////////////////////////////////// |
| function TitansimConfiguration_ViewModel(p_fileHandler) { |
| "use strict"; |
| |
| var v_fileHandler = p_fileHandler; |
| var v_loader; |
| |
| this.loadFile = v_fileHandler.loadFile; |
| this.loadCss = v_fileHandler.loadCss; |
| |
| this.load = function(url, refresh) { |
| v_loader = new FileLoader(url, v_fileHandler); |
| v_loader.taskOperation(refresh); |
| } |
| |
| this.save = function(data) { |
| v_loader.setData(data); |
| v_loader.save(); |
| }; |
| |
| this.restart = function(callback) { |
| v_fileHandler.setData(function() {}, "ExecCtrl", "Restart", "0", 0); |
| |
| function checkOffline() { |
| ping(false, callback); |
| } |
| setTimeout(function() { |
| ping(callback); |
| }, 10000); |
| }; |
| |
| function ping(callback) { |
| function gotAnswer(ans) { |
| if (ans) { |
| callback(); |
| } else { |
| setTimeout(function() { |
| ping(callback); |
| }, 1000); |
| } |
| } |
| |
| v_fileHandler.loadFile("Main.html", gotAnswer); |
| } |
| |
| this.getFileHandler = function() { |
| return v_fileHandler; |
| }; |
| } |
| //# sourceURL=TitansimConfiguration\ViewModel.js |