How to use the most.fromPromise function in most

To help you get started, we’ve selected a few most examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Wonder-Technology / Wonder-Editor / lib / es6_global / src / core / utils / engine / MainUtils.js View on Github external
return Most.drain(Most.map(_handleEngineState, Most.flatMap((function (engineState) {
                        return Most.fromPromise(fetch("./config/editor/setting.json").then((function (response) {
                                          return response.json().then((function (json) {
                                                        var __x = ParseSettingService$WonderEditor.convertToRecord(json);
                                                        StateEditorService$WonderEditor.setState(SetSettingEditorService$WonderEditor.setSetting(__x, StateEditorService$WonderEditor.getState(/* () */0)));
                                                        return Promise.resolve(engineState);
                                                      }));
                                        })));
                      }), Most.flatMap((function (engineState) {
                            return Most.fromPromise(LoaderManagerEngineService$WonderEditor.loadIMGUIAsset("./public/font/empty.fnt", "./public/font/empty.png", /* array */[
github Wonder-Technology / Wonder-Editor / lib / es6_global / src / core / composable_component / mainEditor / composable_component / bottom_components / composable_component / project / composable_component / asset / composable_component / utils / LoadGLTFZipUtils.js View on Github external
return Log$WonderLog.fatal(LogUtils$WonderEditor.buildFatalMessage("shouldn\'t has unsupport gltf data file", "", "", ""));
                                  default:
                                    return /* () */0;
                                }
                                if (exit === 1) {
                                  ArrayService$WonderEditor.push(Most.fromPromise(ZipObject$WonderBsJszip.asyncUint8(zipEntry, undefined, /* () */0).then((function (content) {
                                                  MutableHashMapService$WonderCommonlib.set(FileNameService$WonderEditor.getBaseName(relativePath), content.buffer, outerDataMap);
                                                  return Promise.resolve(/* () */0);
                                                }))), streamArr);
                                  return /* () */0;
                                }
                                
                              }
                            }));
                      return MostUtils$Wonderjs.concatArray(streamArr);
                    }), Most.fromPromise(Zip$WonderBsJszip.loadAsync(Curry._1(createJsZipFunc, /* () */0), undefined, /* `blob */[
                            -1055310499,
                            jsZipBlob
                          ])))).then((function (param) {
                var match = gltfJson[0];
                if (match !== undefined) {
                  return _convert(Caml_option.valFromOption(match), outerDataMap, FileNameService$WonderEditor.getBaseName);
                } else {
                  return Log$WonderLog.fatal(LogUtils$WonderEditor.buildFatalMessage("gltf file should exist", "", "", ""));
                }
              }));
}
github Wonder-Technology / Wonder-Editor / lib / es6_global / src / core / composable_component / header / utils / HeaderUtils.js View on Github external
Most.drain(Most.flatMap(handleSceneWdb, Most.flatMap((function (wdbInfo) {
                    return Most.fromPromise(new Promise((function (resolve, _) {
                                      var reader = new FileReader();
                                      Curry._2(FileReader$WonderEditor.onload, reader, (function (result) {
                                              return resolve(/* record */[
                                                          /* name */wdbInfo[/* name */0],
                                                          /* type_ */AssetTreeNodeUtils$WonderEditor.getUploadFileType(wdbInfo[/* name */0]),
                                                          /* result */result
                                                        ]);
                                            }));
                                      return AssetTreeNodeUtils$WonderEditor.readFileByTypeSync(reader, wdbInfo);
                                    })));
                  }), Most.just(wdbInfo)))).then((function () {
          Curry._1(dispatchFunc, [
github Wonder-Technology / Wonder.js / lib / es6_global / src / asset_bundle / import / assemble / AssembleABSystem.js View on Github external
var match$1 = _buildMaterialData(resourceAssetBundleContent, match[1], match[2]);
                var match$2 = _buildGeometryData(resourceAssetBundleContent, allDependencyRABRelativePath, buffer, match$1[2]);
                var match$3 = _buildScriptEventFunctionData(resourceAssetBundleContent, match$2[1]);
                var match$4 = _buildScriptAttributeData(resourceAssetBundleContent, match$3[1]);
                var state$1 = OperateRABAssetBundleMainService$Wonderjs.setAssembleRABData(rabRelativePath, /* tuple */[
                      param[0],
                      match[0],
                      match$1[0],
                      match$1[1],
                      match$2[0],
                      match$3[0],
                      match$4[0]
                    ], match$4[1]);
                StateDataMainService$Wonderjs.setState(StateDataMain$Wonderjs.stateData, OperateRABAssetBundleMainService$Wonderjs.markAssembled(rabRelativePath, state$1));
                return /* () */0;
              }), Most.fromPromise(_buildImageData(resourceAssetBundleContent, buffer, allDependencyRABRelativePath, state)));
}
github Wonder-Technology / Wonder.js / lib / es6_global / src / asset_bundle / all / manifest / ManifestDataSystem.js View on Github external
function buildManifestData(dependencyRelation, param, buildManifestFunc) {
  var abRelativePath = param[0];
  return Most.fromPromise(_getHashId(param[1]).then((function (hashId) {
                    return Promise.resolve(Curry._2(buildManifestFunc, hashId, Js_option.getWithDefault(ArrayService$WonderCommonlib.createEmpty(/* () */0), ImmutableHashMapService$WonderCommonlib.get(abRelativePath, dependencyRelation))));
                  })));
}
github Wonder-Technology / Wonder-Editor / lib / es6_global / src / core / composable_component / mainEditor / composable_component / bottom_components / composable_component / project / composable_component / asset / composable_component / utils / LoadGLTFZipUtils.js View on Github external
}))), streamArr);
                                      return /* () */0;
                                  case ".bin" : 
                                  case ".jpeg" : 
                                  case ".jpg" : 
                                  case ".png" : 
                                      exit = 1;
                                      break;
                                  case ".dds" : 
                                  case ".wav" : 
                                      return Log$WonderLog.fatal(LogUtils$WonderEditor.buildFatalMessage("shouldn\'t has unsupport gltf data file", "", "", ""));
                                  default:
                                    return /* () */0;
                                }
                                if (exit === 1) {
                                  ArrayService$WonderEditor.push(Most.fromPromise(ZipObject$WonderBsJszip.asyncUint8(zipEntry, undefined, /* () */0).then((function (content) {
                                                  MutableHashMapService$WonderCommonlib.set(FileNameService$WonderEditor.getBaseName(relativePath), content.buffer, outerDataMap);
                                                  return Promise.resolve(/* () */0);
                                                }))), streamArr);
                                  return /* () */0;
                                }
                                
                              }
                            }));
                      return MostUtils$Wonderjs.concatArray(streamArr);
github fanduel-oss / refract / examples / typeahead / most / src / index.js View on Github external
.map(search =>
            fromPromise(
                fetch(
                    `https://api.github.com/search/users?q=${search}&sort=followers`
                )
            )
        )
github plaid / async-problem / most.js View on Github external
const concatFiles = path =>
  most.fromPromise (readFile (path ('index.txt')))
  .map (S.lines)
  .map (S.map (path))
  .map (S.map (readFile))
  .map (Promise.all.bind (Promise))
  .awaitPromises ()
  .map (S.joinWith (''))
  .reduce ((x, y) => x + y, '');
github Wonder-Technology / Wonder.js / lib / es6_global / src / asset / FetchCommon.js View on Github external
function createFetchBlobStream(filePath, fetchFunc) {
  return Most.fromPromise(fetchFunc(filePath).then((function (prim) {
                    return prim.blob();
                  })));
}
github Wonder-Technology / Wonder-Editor / lib / es6_global / src / core / composable_component / header / utils / publish / local / HeaderPublishLocalUtils.js View on Github external
}), Most.flatMap((function (zip) {
                            return Most.fromPromise(loadAndWriteIndexHtmlData(useWorker, sceneGraphArrayBuffer, fetchFunc, zip));
                          }), createZipStream))));
}