Commit a71e51d2 authored by 张博's avatar 张博

use previous promise method and add getRegisterProtocol function

parent 419da45d
/*! /*!
* ==================================================== * ====================================================
* kityminder - v1.4.1 - 2015-07-09 * kityminder - v1.4.1 - 2015-07-10
* https://github.com/fex-team/kityminder-core * https://github.com/fex-team/kityminder-core
* GitHub: https://github.com/fex-team/kityminder-core.git * GitHub: https://github.com/fex-team/kityminder-core.git
* Copyright (c) 2015 Baidu FEX; Licensed MIT * Copyright (c) 2015 Baidu FEX; Licensed MIT
...@@ -691,7 +691,11 @@ _p[11] = { ...@@ -691,7 +691,11 @@ _p[11] = {
function registerProtocol(name, protocol) { function registerProtocol(name, protocol) {
protocols[name] = protocol; protocols[name] = protocol;
} }
function getRegisterProtocol(name) {
return name === undefined ? protocols : protocols[name] || null;
}
exports.registerProtocol = registerProtocol; exports.registerProtocol = registerProtocol;
exports.getRegisterProtocol = getRegisterProtocol;
// 导入导出 // 导入导出
kity.extendClass(Minder, { kity.extendClass(Minder, {
// 自动导入 // 自动导入
...@@ -841,7 +845,7 @@ _p[11] = { ...@@ -841,7 +845,7 @@ _p[11] = {
}; };
// 导入前抛事件 // 导入前抛事件
this._fire(new MinderEvent("beforeimport", params)); this._fire(new MinderEvent("beforeimport", params));
return protocol.decode(data, this, option).then(function(json) { return Promise.resolve(protocol.decode(data, this, option)).then(function(json) {
minder.importJson(json); minder.importJson(json);
return json; return json;
}); });
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12,7 +12,13 @@ define(function(require, exports, module) { ...@@ -12,7 +12,13 @@ define(function(require, exports, module) {
function registerProtocol(name, protocol) { function registerProtocol(name, protocol) {
protocols[name] = protocol; protocols[name] = protocol;
} }
function getRegisterProtocol(name) {
return name === undefined ? protocols : (protocols[name] || null);
}
exports.registerProtocol = registerProtocol; exports.registerProtocol = registerProtocol;
exports.getRegisterProtocol = getRegisterProtocol;
// 导入导出 // 导入导出
kity.extendClass(Minder, { kity.extendClass(Minder, {
...@@ -194,7 +200,7 @@ define(function(require, exports, module) { ...@@ -194,7 +200,7 @@ define(function(require, exports, module) {
// 导入前抛事件 // 导入前抛事件
this._fire(new MinderEvent('beforeimport', params)); this._fire(new MinderEvent('beforeimport', params));
return protocol.decode(data, this, option).then(function(json) { return Promise.resolve(protocol.decode(data, this, option)).then(function(json) {
minder.importJson(json); minder.importJson(json);
return json; return json;
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment