UNPKG

wonder.js

Version:
100 lines (87 loc) 4.48 kB
'use strict'; var Caml_array = require("bs-platform/lib/js/caml_array.js"); var Log$WonderLog = require("wonder-log/lib/js/src/Log.js"); var OptionService$Wonderjs = require("../../../atom/OptionService.js"); var ImmutableHashMapService$WonderCommonlib = require("wonder-commonlib/lib/js/src/ImmutableHashMapService.js"); function getWholeDependencyRelationMap(wabRelativePath, state) { return ImmutableHashMapService$WonderCommonlib.get(wabRelativePath, state[/* assetBundleRecord */47][/* wabData */2][/* wholeDependencyRelationMap */2]); } function unsafeGetWholeDependencyRelationMap(wabRelativePath, state) { return OptionService$Wonderjs.unsafeGet(getWholeDependencyRelationMap(wabRelativePath, state)); } function setWholeDependencyRelationMap(wabRelativePath, wholeDependencyRelation, state) { var assetBundleRecord = state[/* assetBundleRecord */47]; var newrecord = Caml_array.caml_array_dup(state); var init = assetBundleRecord[/* wabData */2]; newrecord[/* assetBundleRecord */47] = /* record */[ /* assembleRABData */assetBundleRecord[/* assembleRABData */0], /* assembleSABData */assetBundleRecord[/* assembleSABData */1], /* wabData : record */[ /* isLoadedMap */init[/* isLoadedMap */0], /* loadedWABMap */init[/* loadedWABMap */1], /* wholeDependencyRelationMap */ImmutableHashMapService$WonderCommonlib.set(wabRelativePath, wholeDependencyRelation, assetBundleRecord[/* wabData */2][/* wholeDependencyRelationMap */2]) ] ]; return newrecord; } function _markIsLoaded(wabRelativePath, isLoaded, state) { var assetBundleRecord = state[/* assetBundleRecord */47]; var newrecord = Caml_array.caml_array_dup(state); var init = assetBundleRecord[/* wabData */2]; newrecord[/* assetBundleRecord */47] = /* record */[ /* assembleRABData */assetBundleRecord[/* assembleRABData */0], /* assembleSABData */assetBundleRecord[/* assembleSABData */1], /* wabData : record */[ /* isLoadedMap */ImmutableHashMapService$WonderCommonlib.set(wabRelativePath, isLoaded, assetBundleRecord[/* wabData */2][/* isLoadedMap */0]), /* loadedWABMap */init[/* loadedWABMap */1], /* wholeDependencyRelationMap */init[/* wholeDependencyRelationMap */2] ] ]; return newrecord; } function getLoadedWAB(wabRelativePath, state) { return ImmutableHashMapService$WonderCommonlib.get(wabRelativePath, state[/* assetBundleRecord */47][/* wabData */2][/* loadedWABMap */1]); } function unsafeGetLoadedWAB(wabRelativePath, state) { return OptionService$Wonderjs.unsafeGetWithMessage(Log$WonderLog.buildAssertMessage("wab arrayBuffer in wabRelativePath:" + (String(wabRelativePath) + " loaded"), "not"), getLoadedWAB(wabRelativePath, state)); } function setLoadedWAB(wabRelativePath, wab, state) { var assetBundleRecord = state[/* assetBundleRecord */47]; var newrecord = Caml_array.caml_array_dup(state); var init = assetBundleRecord[/* wabData */2]; newrecord[/* assetBundleRecord */47] = /* record */[ /* assembleRABData */assetBundleRecord[/* assembleRABData */0], /* assembleSABData */assetBundleRecord[/* assembleSABData */1], /* wabData : record */[ /* isLoadedMap */init[/* isLoadedMap */0], /* loadedWABMap */ImmutableHashMapService$WonderCommonlib.set(wabRelativePath, wab, assetBundleRecord[/* wabData */2][/* loadedWABMap */1]), /* wholeDependencyRelationMap */init[/* wholeDependencyRelationMap */2] ] ]; return newrecord; } function markLoaded(wabRelativePath, state) { return _markIsLoaded(wabRelativePath, true, state); } function markNotLoaded(wabRelativePath, state) { return _markIsLoaded(wabRelativePath, false, state); } function isLoaded(wabRelativePath, state) { var match = ImmutableHashMapService$WonderCommonlib.get(wabRelativePath, state[/* assetBundleRecord */47][/* wabData */2][/* isLoadedMap */0]); if (match !== undefined) { return match; } else { return false; } } exports.getWholeDependencyRelationMap = getWholeDependencyRelationMap; exports.unsafeGetWholeDependencyRelationMap = unsafeGetWholeDependencyRelationMap; exports.setWholeDependencyRelationMap = setWholeDependencyRelationMap; exports._markIsLoaded = _markIsLoaded; exports.getLoadedWAB = getLoadedWAB; exports.unsafeGetLoadedWAB = unsafeGetLoadedWAB; exports.setLoadedWAB = setLoadedWAB; exports.markLoaded = markLoaded; exports.markNotLoaded = markNotLoaded; exports.isLoaded = isLoaded; /* Log-WonderLog Not a pure module */