在 V14.0 新版本中,fromJSON 支持渐进加载的模式,并且提供回调接口供调用者了解加载进度,如下方动图所示
API 代码参考:
- // add increamentLoad in deserializationOptions
- IDeserializationOptions {
- doNotRecalculateAfterLoad?: boolean;
- + incrementalLoading?: boolean | {
- loaded: ()=>void;
- loading: (number)=>void;
- };
- }
-
-
- // Sample
- spread.fromJSON(JSON.parse(jsonStr), {
- doNotRecalculateAfterLoad: true,
- incrementalLoading: {
- loaded: function(){alert("load finish.")};
- loading: function(progress){console.log(progress)};
- }
- });
复制代码
|
|