@acoustic-content-sdk/utils 中文文档教程

发布于 4年前 浏览 19 更新于 3年前

npm

API Documentation

主页 > @acoustic-content-sdk/utils

utils package

此库包含一组实用函数,可帮助针对 [Watson Content Hub](https://www.ibm. com/products/watson-content-hub)。

一些函数是非常通用的辅助函数。 我们使用它们代替“lodash”来减小尺寸并提高速度。

Classes

ClassDescription
ClientStorageService
SiteInformation
StaticResourcesAccessor for static resources, placed next to the application

Enumerations

EnumerationDescription
ItemStatus
RxLoggerChecks what to log

Functions

FunctionDescription
_getResourceUrlFromApiURL(aApiURL)Computes the resource URL given the API URL
absoluteURL(aUrl, aDoc, aWindow)Makes sure the URL is absolute, resolved against the base URL
binarySearch(arr, x, cmp)Performs a binary search on the array
cacheLast(aEqualFunction, scheduler)Operator that will replay the last value of a sequence to potentially many subscribers. The following assertions hold true:- there will be no identical subsequent values - there will be at most one subscription to the original sequence - if there are no more subscriptions to the resulting observable (refcount falls to zero), the operator unsubscribes from the source - if the original sequence has produced at least one value, this value will be the startingThis operator differs from shareReplay(1) in the following way (in addition to ensuring a unique sequence): - if the source observable is hot, then shareReplay(1) will never unsubscribe even if its subscriptions fall to zero. cacheLast will unsubscribe - if the source observable is cold but still producing values when subscriptions fall to zero, then shareReplay(1) will not unsubscribe and will not cancel the sequence. cacheLast will unsubscribe and cancel the sequence.This operator differs from shareReplay({bufferSize: 1, refCount: true}) in the following way (in addition to ensuring a unique sequence): - if subscriptions fall to zero, then with shareReplay the first value that subsequent subscriptions will get is the first value of a new subscription to the source sequence. With cacheLast the first value will be the last value of the previous subscription.
chunkArray(aArray, aSize)Splits the array into even chunks
clientStorageFromWindow(aScope, aWindow)Returns our storage object from the window
cloneDeep(aValue)Performs a deep clone for the value, supports just plain objects and arrays
cloneUrlConfig(aUrlConfig)Constructs a clone
createDeliveryContentItem(aItem)Converts a v1 delivery item structure into a simplified structure
createDeliveryContentItemWithMetadata(aItem)Merges metadata into each level
createError(aMessage, aCause)
createGetter(aGetter)Constructs a getter description
createGetterOnObservable(aObservable, aInitial)Constructs a getter description
createLoggerService(aLoggerFactory)Constructs a logger service on the basis of a logger factory. The service makes sure not to create the same logger multiple times
createMarkupRendererV2(aDeliveryContent, aAuthoringType, aLayoutMapping, aLayout, aMarkupTemplate, aExtendedContext$, aLoggerService, aScheduler)Constructs a new renderer that applies a handlebars transform to produce rendered markup. The markup will be kept current whenever any of the underlying data changes.
createMessageHandler(aCorsWhitelist, aMsgHandlers, aLogger)Constructs an event listener that listens for messages
createNavigateByPathHandler(aNavigate, aLogger)Executes a navigation event
createRefreshHandler(aRefresh, aLogger)Executes a refresh event
createSetModeHandler(aPublicApiHandler, aLogger)Executes a navigation event
createSetterOnSubject(aSubject)Constructs a setter description
createSubscribeActiveRouteHandler(onActiveRenderingContext, aLogger)Subscribes to the active route
createSubscribeModeHandler(onUsePublic, aLogger)Subscribes to the active route
createSubscribeRouteHandler(aGetRenderingContextByPath, aLogger)Subscribes to a given route
createUnsubscribeHandler(aLogger)Subscribes to a given route
dbgAddSource(aSource, aObject)Adds source information
dbgCounter()
filterArray(aArray, aPredicate)Filters an array
flattenArray(aArray)
forEach(aArray, aConsumer)Just run a callback for each element in an array
forIn(aObject, aConsumer)Run a callback for each key value pair
fromObservableOrT(aValue)Converts the generic type into an observable of the desired type
generateItem(aGenerator)Creates an observable that exposes the result of the function call if the result is defined. Otherwise this is an empty sequence.
getAuthoringConfigElements(aType)Returns the authoring config elements
getAuthoringContentElements(aType)Returns the authoring content elements
getBaseUrlFromDocument(aDoc, aWindow)Extracts the base URL from the current document
getBaseUrlFromWindow(aWindow, aDocument)Returns a base URL from the window
getItemStatus(aRenderingContext)Decodes the item status from the rendering context. This can e.g. be used to display status icons
getLinksByRel(aDocument, aWindow)Returns all links in the document, ordered by rel
getOrigin(aDoc, aWindow)Returns the orign from the doc
hashString(oldHash, s)
httpCreateTimer(aOptions)Creates a timer that fires at a randomly chosen interval as soon as subscribed to it
httpGetJsonResource(aURL, aHttpService, aWithCredentials, aTrigger, aOptions, aLogger)
httpGetStringResource(aURL, aHttpService, aWithCredentials, aTrigger, aOptions, aLogger)Represents an HTTP request, potentially made via the cache
isArrayLikeOf(aValue, aPredicate)Tests if all elements of the array are of a particular type
isArrayOf(aValue, aPredicate)Tests if all elements of the array are of a particular type
isAuthoringConfigElement(aElement)Checks if an element is a config element
isAuthoringContentElement(aElement)Checks if an element is a content element
isAuthoringGroup(value)
isAuthoringGroupElement(aValue)Tests if a field is a content type
isAuthoringImage(value)
isAuthoringReference(value)
isAuthoringReferenceValue(value)
isAuthoringText(value)
isAuthoringVideo(value)
isCategory(aValue, bOptional)
isCategoryElement(aValue, bOptional)Tests if an element is a category element
isDate(aValue)Tests if a value is a date
isDateElement(aValue)Tests if an element is a date element
isDeliveryReferenceElement(aValue)Tests if a value is a delivery reference element
isElement(aValue, bOptional)Tests if the value is a value element
isElementType(aValue)Tests if the value is a valid element type
isEqual(aLeft, aRight)
isErrorResponse(aResponse)Tests if a response is an error response
isFile(aValue, bOptional)Tests if an element is a video. If the element is optional, it can be null or an arbitrary object. Otherwise we must have at least an asset and a URL.
isFileElement(aValue)Tests if an element is a file element
isFormattedTextElement(aValue)Tests if an element is a text element
isGroupElement(aValue, bOptional)Tests if an element is a Group element
isImage(aValue, bOptional)Tests if an element is an image. If the element is optional, it can be null or an arbitrary object. Otherwise we must have at least an asset and a URL.
isImageElement(aValue)Tests if an element is an image element
isLink(aValue, bOptional)Tests if we have a link element. We consider the element to exist if it has at least one of its fields set.
isLinkElement(aValue)Tests if an element is a link element
isLocalizedText(aText)Tests if a value is a localized context
isLocation(aValue, bOptional)
isLocationElement(aValue, bOptional)Tests if an element is a location element
isMetadata(aValue)Tests if the object is valid metadata
isMultiDateElement(aValue, bOptional)Tests if an element is a text element
isMultiFileElement(aValue, bOptional)Tests if an element is a file element
isMultiFormattedTextElement(aValue, bOptional)Tests if an element is a text element
isMultiGroupElement(aValue, bOptional)Tests if an element is a Group element
isMultiImageElement(aValue, bOptional)Tests if an element is an image element
isMultiLinkElement(aValue, bOptional)Tests if an element is an image element
isMultiNumberElement(aValue, bOptional)Tests if an element is a number element
isMultiOptionSelectionElement(aValue, bOptional)Tests if an element is an option selection element
isMultiProductElement(aValue, bOptional)Tests if an element is a text element
isMultiReferenceElement(aValue, bOptional)Tests if an element is a reference element
isMultiTextElement(aValue, bOptional)Tests if an element is a text element
isMultiToggleElement(aValue, bOptional)Tests if an element is a toggle element
isMultiVideoElement(aValue, bOptional)Tests if an element is an image element
isNumberElement(aValue)Tests if an element is a number element
isObjectOf(aValue, aPredicate)Tests if all fields of an object are of a particular type
isOptional(aValue, aPredicate)
isOptionalArrayOf(aValue, aPredicate)
isOptionSelectionElement(aValue)Tests if an element is an option selection element
isPlainObject(aObject)Tests for a plain object
isProductElement(aValue)
isReferenceElement(aValue)Tests if an element is a reference element
isRenderingContextProvider(aValue)Tests is an object is a rendering context provider
isRenderingContextV2(aValue)Tests if the object is a valid rendering context
isSingleDateElement(aValue, bOptional)Tests if an element is a date element
isSingleFileElement(aValue, bOptional)Tests if an element is a file element
isSingleFormattedTextElement(aValue, bOptional)Tests if an element is a text element
isSingleGroupElement(aValue, bOptional)Tests if an element is a Group element
isSingleImageElement(aValue, bOptional)Tests if an element is an image element
isSingleLinkElement(aValue, bOptional)Tests if an element is an image element
isSingleNumberElement(aValue, bOptional)Tests if an element is a number element
isSingleOptionSelectionElement(aValue, bOptional)Tests if an element is an option selection element
isSingleProductElement(aValue, bOptional)Tests if an element is a text element
isSingleReferenceElement(aValue, bOptional)Tests if an element is a reference element
isSingleTextElement(aValue, bOptional)Tests if an element is a text element
isSingleToggleElement(aValue, bOptional)Tests if an element is a toggle element
isSingleVideoElement(aValue, bOptional)Tests if an element is an image element
isTextElement(aValue)Tests if an element is a text element
isToggleElement(aValue, bOptional)Tests if an element is a toggle element
isURL(aValue)
isUrlConfig(aValue)Tests if a value is a valid url config object
isValueOf(aType, aValue, bOptional)Tests if the value is a value element
isVideo(aValue, bOptional)Tests if an element is a video. If the element is optional, it can be null or an arbitrary object. Otherwise we must have at least an asset and a URL.
isVideoElement(aValue)Tests if an element is a video element
kebabCase(str)
logModule(aVersion, aModule, aLogSvc)Logs version information for a module
longHash()Returns an initial value for the hash code
luceneEscapeKeyValue(aKey, aTerm)Generates a search selector and escapes the value. If the value is missing the method generates an expression that searches for missing values.
luceneEscapeKeyValueAnd(aKey, aTerms)Generates a selector and joins with 'AND'
luceneEscapeKeyValueOr(aKey, aTerms)Generates a selector and joins with 'OR'
luceneEscapeTerm(aTerm)Escapes a term according to lucence syntax
mapArray(aArray, aMapper)Maps every value in an array
mergeObjects(aLeft, aRight)Merge objects together and consider undefined or empty objects as not overridable
nary(aArity, aFunction)Implements a wrapper function that limits the arguments to the given size
pageArrayEquals(aLeft, aRight)Tests if two page arrays are equal
pageCloneSitePage(aSitePage)Performs a shallow clone of a site page
pageCreatePartialSiteContextForSitePage(aPage, aSite)Returns the partial rendering context for a site page
pageCreateSiteContextFromSearchResult(aPage, aSearchResult, aSite)Decomposes a search result into a site context structure
pageEquals(aLeft, aRight)Tests if two pages are equal
pageGetEncodedPath(aPath)Make sure we use a consistent encoding
parseQueryString(aQuery)Parses the query string into key/value pairs
pathForSearch(aPath)
perfMeasure(aName)
pluckPath(aPath, aDefault)Returns a function that plucks the given path from an object
queryToCanonicalString(aValue)Converts various inputs into a query string.
queryToString(aValue)Converts various inputs into a query string.
reduceArray(aArray, aReducer, aInitial)Tests every value in an array
reduceForIn(aObject, aFunction, aInitial)Run a callback for each key value pair
reduceToObject(aArray, aKeyExtractor, aTransformer)Groups an array into an object given a key extractor
rxBackpressure(aDelegate)Implementation of a backpressure operator. The operator will combine source items into chunks and produces a result observable per chunk. It will buffer source items as long as the observable of the last chunk has not finished, yet.
rxCachedFunction(aDelegate, aAccessor)Implements a function that caches the result of another function
rxLayoutIdFromRenderingContext(aLayoutMode, aRenderingContext, aTypeAccessor, aLayoutMappingAccessor, aLogSvc, aScheduler)Decodes the layout id from a type or provider
rxUrlFromProvider(aProvider)Converts the provider into a URL
rxWchFromAuthoringTypeByAccessor(aAccessor, aTypeId, aSelector, aTypeAccessor, aScheduler)Decodes information from the authoring element identified by the accessor expression. The method will first locate the correct authoring element based on the accessor and then applies a selector to extract the desired value from the element.
rxWithSubscriptionCount(aCallback)Returns an operator that invokes a callback with the subscription count
safeCmp(aComparator)Generates a safe comparator that also works if the arguments are nil
sendJsonRequest(aUrl, aOptions, aTrigger, aHttpService, aLogger)Sends a request to the given options object and allows to trigger a refresh via the given trigger.
sendRequest(aUrl, aOptions, aTrigger, aRequest, aLogger)Sends a request to the given options object and allows to trigger a refresh via the given trigger.
sendTextRequest(aUrl, aOptions, aTrigger, aHttpService, aLogger)Sends a request to the given options object and allows to trigger a refresh via the given trigger.
siteContextEquals(aLeft, aRight)Tests if two site contexts are equal
thisThenThat(aFirst, aNext)Combines two observables such that the events on the first one are used until the second one starts to produce an event. From then on only the events on the second one will be used and the first one canceled.
toInteger(aValue, aDefault)Converts the value to an integer
urlConfigEquals(aLeft, aRight)Tests if two UrlConfig objects are equal
urlEquals(aLeft, aRight)Tests if two URL objects are equal
urlFromProvider(aProvider)Converts the provider into a URL
urlSlashes(aUrl)Makes sure that a path starts and ends with slash
urlToString(aURL)Shortcut to convert a URL to a string
wchAddDebug(aPath, aRenderingContext)
wchAddTypings(aRenderingContext)Adds typings next to the elements
wchAdjustRenderingContextSearchQuery(aQuery)Analyzes the search query and makes sure that it contains the required fields.
wchAdjustSitePagesSearchQuery(aQuery, aSiteId)Analyzes the search query and makes sure that it contains the required fields.
wchAuthoringElementFromAccessor(aAccessor, aType)Decodes the authoring element from the accessor expression
wchBoxFetchLevels(aLevels, aDefault)Returns the number of fetch levels
wchBoxLayoutMode(aMode)Maps unknown or empty modes
wchCreateUrlConfig(aBaseUrl, aApiUrl, aResourceUrl, aDocument)Constructs a interface based on some optional config values.
wchCycleHandling(aCycle)
wchDecodeAccessor(aPrototype, aAccessor)Tranlates the accessor to an expression
wchDecodeExpression(aExpression)Decodes the expression back to an expression into elements. The expression might point either to the optimized element or to the elements structure itself.
wchDeliveryContentByAccessor(aItem, aAccessor)Returns the element identified by the accessor string from a content item in delivery format
wchElementFromRenderingContext(aContext, aAccessor)Decodes an element from the accessor
wchForEachRenderingContext(aRenderingContext, aCallback)Iterates over all rendering contexts referenced by this context
wchForEachType(aType, aCallback)Resolves all typeRef
wchGetApiUrlFromResourceURL(aResourceURL)Computes the API URL given the resource URL
wchGetApiUrlInContext(aApiUrl, aBaseURL, aPreviewCheck)Constructs a API URL based on a context check callback
wchGetBaseURL(aDocument, aWindow)Decodes the base URL. The base URL is the URL that all routing URLs will start with and will be resolved as relative. The URL ends with a slash character. See .
wchGetHubInfoFromBaseURL(aBaseURL)Decodes the hub info from the base URL. This assumes that the application is served from a location in WCH.
wchGetHubInfoFromLinks(aDocument, aWindow)Decodes the hub info from links in the document
wchGetHubInfoUrlProvider(aApiUrl, aPreviewCheck)Exposes a provider based on a API URL and a preview callback
wchGetLayout(aLayoutMode, aContext)Returns the layout object for a particular mode for the rendering context
wchGetPageSearchURL(aPath, aSiteId)Returns the URI for a page search URL
wchGetParentPageURL(aParentId, aSiteId)Returns the URI for a parent page search
wchGetSearchURL(aQueryString)Builds the search query string
wchGetSiteContextURL(aParentId, aPageId, aSiteId)Returns the URI for a page search URL
wchInsertPlaceholders(aRenderingContext, aResolver)
wchIsPreviewMode(aBaseURL)Determines if the server is running in preview mode
wchPlaceholderFromAccessor(aAccessor, aType)Decodes the placeholder from an accessor expression
wchPlaceholderResolver(aTag, aSearch)Returns a resolver for placeholders based on WCH search
wchPrepareRenderingContextInterceptors(aRenderingContextInterceptors)Prepare a list of interceptors
wchResolveRenderingContext(aRenderingContext, aStrategy, aRenderingContextById, aLogger)Resolves the rendering context according to the configured strategy
wchResolveType(aType)Resolves all typeRef
wchSelectAccessor(aAccessor)parses a path expression
wchTypeFromAccessor(aAccessor, aType)Decodes the element type from an accessor expression

Interfaces

InterfaceDescription
Bind
BindKey
BindMember
ClientStorage
HttpOptions
HttpService
JSONArray
JSONObject
ObserverConsumer
Partial
RenderingContextInterceptors
RenderingContextMap
RxCompose
RxPipe
SpreadArgs
ZippedArgs

Variables

VariableDescription
andPerforms the "and" function
anyToString
arrayEqualsTests if two arrays are equal
arrayPushPushes a value to an array
assertArray
assertFromFunction
assertFromGenerator
assertObject
assignObject
authoringLayoutMappingToDeliveryLayoutMappingConverts an authoring layout item to a delivery layout item
authoringLayoutToDeliveryLayoutConverts an authoring layout item to a delivery layout item
authoringTypeToDeliveryTypeConverts an authoring layout item to a delivery layout item
biComposeRepresents the composition of two functions
biComposeMonoRepresents the composition of two functions where they have the same argument
binaryGuarantees a binary function
bindOur simple implementation
bindKeyThe bind member magic
bindMemberThe bind member magic
boxLoggerServiceFunction to return the NOOP_LOGGER service in case the logger service passed in is nil
byPropertyGenerates a predicate that compares a named property of an object with another predicate
cancelExecuteLater
cloneURLClones the URL object into a bean
cmpByLocalizedContextReturns a comparator that orders localizations according to the preferences of a localized context
cmpNumbersExports a comparator for numbers
cmpStringsExports a comparator for numbers
composeRepresents the composition of two functions
composeAllComposes the sequence of functions
constGenerator
createCacheConstructs a new cache
createConsoleLogger
createConsumerOnSubjectBinds to the next function of a subject
createEmptyLogger
createLruCacheConstructs a new cache
createObservableAdaptorConstructs an adaptor around an existing observable. This helps for cross frame access to observables.
createObserverConsumer
createSingleSubjectConstructs a singe replay subject
deepDistinctUntilChanged
deepEqualsTests if two objects are identical
DEFAULT_FETCH_LEVELS
DEFAULT_HTTP_RESOURCE_OPTIONS
DEFAULT_LAYOUT_MAPPING
DEFAULT_LAYOUT_MODE
EMPTY_JSON_OBSERVABLEThe empty observable instance, we can reuse the same
EMPTY_RENDERING_CONTEXT
EMPTY_SITE_CONTEXT
EMPTY_STRING_OBSERVABLEThe empty observable instance, we can reuse the same
escapeHtmlApplies HTML escaping to strings
executeLater
FALSE$Operator representing false
filterArrayOfReturns an operator function that filters array of a particular type
filterBoolean
filterNotNil
filterNumber
filterObject
filterString
filterTypeOfOnly returns objects of a particular type
firstElement
flipArgsswitch the order of arguments
fromGeneratorOrT
FUNCTION_TYPE
getCategoryLeafExtracts the last category element
getPathExtracts the value of the path for the property
getPropertyGenerates a function that returns a property
hashRandomClassNameReturns some random identifier
hashRandomIdentifierReturns some random identifier
hashRandomLinkNameReturns some random identifier
hashToClassNameConverts a hash number into a CSS class name
hashToIdentifierConverts a hash number into a javascript identifier
hashToLinkNameConverts a hash number into a javascript identifier
idleFrameScheduler
isAbsoluteURLTests if a URL is an absolute URL
isArrayTests if a value is an array
isArrayLikeTests if a value is like an array, i.e. it has the length property
isBooleanTests if a value is a boolean value
isDeepEqualToReturns a function that tests if a value is equal to another value
isEmptyTests if an array is empty
isEqualToReturns a function that tests if a value is equal to another value
isEqualVersionTests if two versions are equal
isFunctionTests if an object is a function
isNeverNever predicate, that never is true
isNilChecks for nil
isNilOrEmptyTests if the array does not exist or if it is empty
isNotEmptyTests if an array is not empty
isNotNilChecks for nil
isNumberTests if a value is a number value
isStringTests if an object is a string
isStringArrayTests if all elements of the array are of type string
isUndefinedChecks for undefined
jsonParse
jsonStringEscape
jsonStringify
KEY_CYCLE
KEY_LAYOUT_MODE
KEY_LEVELS
KEY_RENDERING_CONTEXT_MAP
KEY_RENDERING_CONTEXT
lastElement
LAYOUT_TYPE_ANGULAR
LAYOUT_TYPE_HANDLEBARS
lazyGeneratorCreates a lazy generator for the value
lazyProxyReturns an object that is lazily constructed when first accessed
localizedTextexpose a tuple as text
mapDefaultOperator that returns the default value for each nil value of the source sequence
mapTypeOfReturns the object if it is of a particular type, else undefined
mergeHubInfoMerges the config of two hub infos
MODULEModule name
NOOP_LOGGER_SERVICEFallback logger service that exposes noop loggers
notNegates a function
NULL$Operator representing undefined
nullaryGuarantees a nullary function
objectAssignAssigns a property to an object and returns that object
objectEqualsTests if two objects are equal
objectKeysMake sure we have some of the central functions
opBoxLayoutModeOperator to box the layout mode
opCacheLastConvenience operator for cacheLast()
opDeepDistinctUntilChangedLike using deepEquals
opDistinctUntilChangedLike
opFalseOperator representing false
opFilterBooleanFilters booleans
opFilterNeverFilter that will completely ignore all events
opFilterNotNilMakes sure the sequence does not have nils
opFilterNumberFilters number
opFilterObjectFilters plain objects
opFilterStringFilters strings
opJsonParseParses a string into a JSON object
opLevelsConverts the levels to a valid number value
opNotNegates a boolean
opPageArrayDistinctUntilChangedLike using pageArrayEquals()
opPageDistinctUntilChangedLike using pageEquals()
opPluckApiOriginExtracts the origin of the API URL from the rendering context
opPluckCurrentPageOperator to pluck the current page
opPluckDistinctPageOperator to pluck a distinct page
opPluckResourceOriginExtracts the origin of the Resource URL from the rendering context
opReplayLastConvenience operator for replayLast()
opShallowDistinctUntilChangedLike using shallowEquals
opShareLastShares and replays only the latest emission
opTrueOperator representing true
orPerforms the "or" function
pageArrayDistinctUntilChanged
pageDistinctUntilChanged
pageFromRenderingContextExtracts the selected page from the rendering context
parsePathOur parsing function, we assume that the resulting array is read only
parseURLParses a URL or string into a URL object
partialFirstBinds the first parameter
partialLeftOur simple implementation
partialSecondBinds the second parameter
pluckApiOriginExtracts the origin of the API URL from the rendering context
pluckCurrentPage
pluckLocaleAccessor for locales from a localized context
pluckPropertyGenerates a function that returns a property
pluckResourceOriginExtracts the origin of the Resource URL from the rendering context
pluckTextAccessor for text from a localized context
propertyFromObjectGenerates a function that returns a property
replayLastReturns the shareReplay operator with a buffer of 1 and refCount: true
rxCompose
rxErrorFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxLogReturns a function that logs particular aspects of a subscription
rxLogAllFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxLogMemberReturns a function that logs particular aspects of a subscription
rxLogNextFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxMemoizeOperator that caches the result of a previous operator and monitors the result for changes
rxNextFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxPipeFunction that pipes the arguments to the stream passed as the first argument
rxPluckPathOperator to pluck a certain path
rxSelectPathMemoized selector for a particular path
rxSelectPropertyMemoized selector for a particular property
safeMergeMap
safeSwitchMap
safeUnsubscribeUnsubscribes if the subscription exists.
safeUnsubscribeAllUnsubscribes if the subscription exists.
SEARCH_MAX_ROWS
selectApiUrl
selectBaseUrl
selectPreviewMode
selectResourceUrl
shallowEqualsTests if two objects are identical
shareLast
spreadArgsWraps a function such that it accepts an array of parameters instead of individual parameters.
switchMapDefaultOperator that returns the default sequence for each nil value of the source sequence
ternaryPerforms the ternary operation
thisThenThatsCombines two observables such that the events on the first one are used until the second one starts to produce an event. From then on only the events on the second one will be used and the first one canceled.
toArrayConverts an array like to an array
TRUE$Operator representing true
typedPluckOperator that plucks a key from an object and makes sure that the key exists
unaryGuarantees a unary function
UNDEFINED_RENDERING_CONTEXT
UNDEFINED_TYPE
UNDEFINED$Operator representing undefined
VERSIONVersion and build number of the package
wchGetSiteURLReturns the URI path for the site
zipArgsExpose the array method in a strongly typed way

Type Aliases

Type AliasDescription
BiConsumer
BiFunction
CacheAccessor
CacheCallback
ComparatorComparison operator
Consumer
EqualsPredicate
Function0
Function1
Function2
Function3
Function4
Generator
GeneratorOrT
IsPredicate
JSONValue
MarkupTemplate
Maybemaybe type
ObservableOrT
ParsedQuery
PlaceholderResolverGiven a series of type IDs, return the placeholder content items
Predicate
Request

Home > @acoustic-content-sdk/utils > ClientStorageService

ClientStorageService class

Signature:

export declare class ClientStorageService implements ClientStorage 

Constructors

ConstructorModifiersDescription
(constructor)(aUrlsService, aWindow)Constructs a new instance of the ClientStorageService class

Properties

PropertyModifiersTypeDescription
get(aKey: string) => JSONValue
put(aKey: string, aValue: JSONValue) => void

Home > ; @acoustic-content-sdk/utils > 站点信息

SiteInformation class

签名:

export declare class SiteInformation 

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the SiteInformation class

Properties

PropertyModifiersTypeDescription
observerObserver<Site>
siteObservable<Site>Attaches the modifications on the current site

Methods

MethodModifiersDescription
getIdByPath(path)Returns an observable that communicates the content IDs of items for a particular path. If the mapping changes, the change will be propagated. If the mapping is unknown (because the site has not been loaded, yet) the m

npm

API Documentation

Home > @acoustic-content-sdk/utils

utils package

This library contains a set of utility functions to help implementing applications of libraries against [Watson Content Hub](https://www.ibm.com/products/watson-content-hub).

Some functions are very general purpose helper functions. We use them instead of 'lodash' to reduce size and improve speed.

Classes

ClassDescription
ClientStorageService
SiteInformation
StaticResourcesAccessor for static resources, placed next to the application

Enumerations

EnumerationDescription
ItemStatus
RxLoggerChecks what to log

Functions

FunctionDescription
_getResourceUrlFromApiURL(aApiURL)Computes the resource URL given the API URL
absoluteURL(aUrl, aDoc, aWindow)Makes sure the URL is absolute, resolved against the base URL
binarySearch(arr, x, cmp)Performs a binary search on the array
cacheLast(aEqualFunction, scheduler)Operator that will replay the last value of a sequence to potentially many subscribers. The following assertions hold true:- there will be no identical subsequent values - there will be at most one subscription to the original sequence - if there are no more subscriptions to the resulting observable (refcount falls to zero), the operator unsubscribes from the source - if the original sequence has produced at least one value, this value will be the startingThis operator differs from shareReplay(1) in the following way (in addition to ensuring a unique sequence): - if the source observable is hot, then shareReplay(1) will never unsubscribe even if its subscriptions fall to zero. cacheLast will unsubscribe - if the source observable is cold but still producing values when subscriptions fall to zero, then shareReplay(1) will not unsubscribe and will not cancel the sequence. cacheLast will unsubscribe and cancel the sequence.This operator differs from shareReplay({bufferSize: 1, refCount: true}) in the following way (in addition to ensuring a unique sequence): - if subscriptions fall to zero, then with shareReplay the first value that subsequent subscriptions will get is the first value of a new subscription to the source sequence. With cacheLast the first value will be the last value of the previous subscription.
chunkArray(aArray, aSize)Splits the array into even chunks
clientStorageFromWindow(aScope, aWindow)Returns our storage object from the window
cloneDeep(aValue)Performs a deep clone for the value, supports just plain objects and arrays
cloneUrlConfig(aUrlConfig)Constructs a clone
createDeliveryContentItem(aItem)Converts a v1 delivery item structure into a simplified structure
createDeliveryContentItemWithMetadata(aItem)Merges metadata into each level
createError(aMessage, aCause)
createGetter(aGetter)Constructs a getter description
createGetterOnObservable(aObservable, aInitial)Constructs a getter description
createLoggerService(aLoggerFactory)Constructs a logger service on the basis of a logger factory. The service makes sure not to create the same logger multiple times
createMarkupRendererV2(aDeliveryContent, aAuthoringType, aLayoutMapping, aLayout, aMarkupTemplate, aExtendedContext$, aLoggerService, aScheduler)Constructs a new renderer that applies a handlebars transform to produce rendered markup. The markup will be kept current whenever any of the underlying data changes.
createMessageHandler(aCorsWhitelist, aMsgHandlers, aLogger)Constructs an event listener that listens for messages
createNavigateByPathHandler(aNavigate, aLogger)Executes a navigation event
createRefreshHandler(aRefresh, aLogger)Executes a refresh event
createSetModeHandler(aPublicApiHandler, aLogger)Executes a navigation event
createSetterOnSubject(aSubject)Constructs a setter description
createSubscribeActiveRouteHandler(onActiveRenderingContext, aLogger)Subscribes to the active route
createSubscribeModeHandler(onUsePublic, aLogger)Subscribes to the active route
createSubscribeRouteHandler(aGetRenderingContextByPath, aLogger)Subscribes to a given route
createUnsubscribeHandler(aLogger)Subscribes to a given route
dbgAddSource(aSource, aObject)Adds source information
dbgCounter()
filterArray(aArray, aPredicate)Filters an array
flattenArray(aArray)
forEach(aArray, aConsumer)Just run a callback for each element in an array
forIn(aObject, aConsumer)Run a callback for each key value pair
fromObservableOrT(aValue)Converts the generic type into an observable of the desired type
generateItem(aGenerator)Creates an observable that exposes the result of the function call if the result is defined. Otherwise this is an empty sequence.
getAuthoringConfigElements(aType)Returns the authoring config elements
getAuthoringContentElements(aType)Returns the authoring content elements
getBaseUrlFromDocument(aDoc, aWindow)Extracts the base URL from the current document
getBaseUrlFromWindow(aWindow, aDocument)Returns a base URL from the window
getItemStatus(aRenderingContext)Decodes the item status from the rendering context. This can e.g. be used to display status icons
getLinksByRel(aDocument, aWindow)Returns all links in the document, ordered by rel
getOrigin(aDoc, aWindow)Returns the orign from the doc
hashString(oldHash, s)
httpCreateTimer(aOptions)Creates a timer that fires at a randomly chosen interval as soon as subscribed to it
httpGetJsonResource(aURL, aHttpService, aWithCredentials, aTrigger, aOptions, aLogger)
httpGetStringResource(aURL, aHttpService, aWithCredentials, aTrigger, aOptions, aLogger)Represents an HTTP request, potentially made via the cache
isArrayLikeOf(aValue, aPredicate)Tests if all elements of the array are of a particular type
isArrayOf(aValue, aPredicate)Tests if all elements of the array are of a particular type
isAuthoringConfigElement(aElement)Checks if an element is a config element
isAuthoringContentElement(aElement)Checks if an element is a content element
isAuthoringGroup(value)
isAuthoringGroupElement(aValue)Tests if a field is a content type
isAuthoringImage(value)
isAuthoringReference(value)
isAuthoringReferenceValue(value)
isAuthoringText(value)
isAuthoringVideo(value)
isCategory(aValue, bOptional)
isCategoryElement(aValue, bOptional)Tests if an element is a category element
isDate(aValue)Tests if a value is a date
isDateElement(aValue)Tests if an element is a date element
isDeliveryReferenceElement(aValue)Tests if a value is a delivery reference element
isElement(aValue, bOptional)Tests if the value is a value element
isElementType(aValue)Tests if the value is a valid element type
isEqual(aLeft, aRight)
isErrorResponse(aResponse)Tests if a response is an error response
isFile(aValue, bOptional)Tests if an element is a video. If the element is optional, it can be null or an arbitrary object. Otherwise we must have at least an asset and a URL.
isFileElement(aValue)Tests if an element is a file element
isFormattedTextElement(aValue)Tests if an element is a text element
isGroupElement(aValue, bOptional)Tests if an element is a Group element
isImage(aValue, bOptional)Tests if an element is an image. If the element is optional, it can be null or an arbitrary object. Otherwise we must have at least an asset and a URL.
isImageElement(aValue)Tests if an element is an image element
isLink(aValue, bOptional)Tests if we have a link element. We consider the element to exist if it has at least one of its fields set.
isLinkElement(aValue)Tests if an element is a link element
isLocalizedText(aText)Tests if a value is a localized context
isLocation(aValue, bOptional)
isLocationElement(aValue, bOptional)Tests if an element is a location element
isMetadata(aValue)Tests if the object is valid metadata
isMultiDateElement(aValue, bOptional)Tests if an element is a text element
isMultiFileElement(aValue, bOptional)Tests if an element is a file element
isMultiFormattedTextElement(aValue, bOptional)Tests if an element is a text element
isMultiGroupElement(aValue, bOptional)Tests if an element is a Group element
isMultiImageElement(aValue, bOptional)Tests if an element is an image element
isMultiLinkElement(aValue, bOptional)Tests if an element is an image element
isMultiNumberElement(aValue, bOptional)Tests if an element is a number element
isMultiOptionSelectionElement(aValue, bOptional)Tests if an element is an option selection element
isMultiProductElement(aValue, bOptional)Tests if an element is a text element
isMultiReferenceElement(aValue, bOptional)Tests if an element is a reference element
isMultiTextElement(aValue, bOptional)Tests if an element is a text element
isMultiToggleElement(aValue, bOptional)Tests if an element is a toggle element
isMultiVideoElement(aValue, bOptional)Tests if an element is an image element
isNumberElement(aValue)Tests if an element is a number element
isObjectOf(aValue, aPredicate)Tests if all fields of an object are of a particular type
isOptional(aValue, aPredicate)
isOptionalArrayOf(aValue, aPredicate)
isOptionSelectionElement(aValue)Tests if an element is an option selection element
isPlainObject(aObject)Tests for a plain object
isProductElement(aValue)
isReferenceElement(aValue)Tests if an element is a reference element
isRenderingContextProvider(aValue)Tests is an object is a rendering context provider
isRenderingContextV2(aValue)Tests if the object is a valid rendering context
isSingleDateElement(aValue, bOptional)Tests if an element is a date element
isSingleFileElement(aValue, bOptional)Tests if an element is a file element
isSingleFormattedTextElement(aValue, bOptional)Tests if an element is a text element
isSingleGroupElement(aValue, bOptional)Tests if an element is a Group element
isSingleImageElement(aValue, bOptional)Tests if an element is an image element
isSingleLinkElement(aValue, bOptional)Tests if an element is an image element
isSingleNumberElement(aValue, bOptional)Tests if an element is a number element
isSingleOptionSelectionElement(aValue, bOptional)Tests if an element is an option selection element
isSingleProductElement(aValue, bOptional)Tests if an element is a text element
isSingleReferenceElement(aValue, bOptional)Tests if an element is a reference element
isSingleTextElement(aValue, bOptional)Tests if an element is a text element
isSingleToggleElement(aValue, bOptional)Tests if an element is a toggle element
isSingleVideoElement(aValue, bOptional)Tests if an element is an image element
isTextElement(aValue)Tests if an element is a text element
isToggleElement(aValue, bOptional)Tests if an element is a toggle element
isURL(aValue)
isUrlConfig(aValue)Tests if a value is a valid url config object
isValueOf(aType, aValue, bOptional)Tests if the value is a value element
isVideo(aValue, bOptional)Tests if an element is a video. If the element is optional, it can be null or an arbitrary object. Otherwise we must have at least an asset and a URL.
isVideoElement(aValue)Tests if an element is a video element
kebabCase(str)
logModule(aVersion, aModule, aLogSvc)Logs version information for a module
longHash()Returns an initial value for the hash code
luceneEscapeKeyValue(aKey, aTerm)Generates a search selector and escapes the value. If the value is missing the method generates an expression that searches for missing values.
luceneEscapeKeyValueAnd(aKey, aTerms)Generates a selector and joins with 'AND'
luceneEscapeKeyValueOr(aKey, aTerms)Generates a selector and joins with 'OR'
luceneEscapeTerm(aTerm)Escapes a term according to lucence syntax
mapArray(aArray, aMapper)Maps every value in an array
mergeObjects(aLeft, aRight)Merge objects together and consider undefined or empty objects as not overridable
nary(aArity, aFunction)Implements a wrapper function that limits the arguments to the given size
pageArrayEquals(aLeft, aRight)Tests if two page arrays are equal
pageCloneSitePage(aSitePage)Performs a shallow clone of a site page
pageCreatePartialSiteContextForSitePage(aPage, aSite)Returns the partial rendering context for a site page
pageCreateSiteContextFromSearchResult(aPage, aSearchResult, aSite)Decomposes a search result into a site context structure
pageEquals(aLeft, aRight)Tests if two pages are equal
pageGetEncodedPath(aPath)Make sure we use a consistent encoding
parseQueryString(aQuery)Parses the query string into key/value pairs
pathForSearch(aPath)
perfMeasure(aName)
pluckPath(aPath, aDefault)Returns a function that plucks the given path from an object
queryToCanonicalString(aValue)Converts various inputs into a query string.
queryToString(aValue)Converts various inputs into a query string.
reduceArray(aArray, aReducer, aInitial)Tests every value in an array
reduceForIn(aObject, aFunction, aInitial)Run a callback for each key value pair
reduceToObject(aArray, aKeyExtractor, aTransformer)Groups an array into an object given a key extractor
rxBackpressure(aDelegate)Implementation of a backpressure operator. The operator will combine source items into chunks and produces a result observable per chunk. It will buffer source items as long as the observable of the last chunk has not finished, yet.
rxCachedFunction(aDelegate, aAccessor)Implements a function that caches the result of another function
rxLayoutIdFromRenderingContext(aLayoutMode, aRenderingContext, aTypeAccessor, aLayoutMappingAccessor, aLogSvc, aScheduler)Decodes the layout id from a type or provider
rxUrlFromProvider(aProvider)Converts the provider into a URL
rxWchFromAuthoringTypeByAccessor(aAccessor, aTypeId, aSelector, aTypeAccessor, aScheduler)Decodes information from the authoring element identified by the accessor expression. The method will first locate the correct authoring element based on the accessor and then applies a selector to extract the desired value from the element.
rxWithSubscriptionCount(aCallback)Returns an operator that invokes a callback with the subscription count
safeCmp(aComparator)Generates a safe comparator that also works if the arguments are nil
sendJsonRequest(aUrl, aOptions, aTrigger, aHttpService, aLogger)Sends a request to the given options object and allows to trigger a refresh via the given trigger.
sendRequest(aUrl, aOptions, aTrigger, aRequest, aLogger)Sends a request to the given options object and allows to trigger a refresh via the given trigger.
sendTextRequest(aUrl, aOptions, aTrigger, aHttpService, aLogger)Sends a request to the given options object and allows to trigger a refresh via the given trigger.
siteContextEquals(aLeft, aRight)Tests if two site contexts are equal
thisThenThat(aFirst, aNext)Combines two observables such that the events on the first one are used until the second one starts to produce an event. From then on only the events on the second one will be used and the first one canceled.
toInteger(aValue, aDefault)Converts the value to an integer
urlConfigEquals(aLeft, aRight)Tests if two UrlConfig objects are equal
urlEquals(aLeft, aRight)Tests if two URL objects are equal
urlFromProvider(aProvider)Converts the provider into a URL
urlSlashes(aUrl)Makes sure that a path starts and ends with slash
urlToString(aURL)Shortcut to convert a URL to a string
wchAddDebug(aPath, aRenderingContext)
wchAddTypings(aRenderingContext)Adds typings next to the elements
wchAdjustRenderingContextSearchQuery(aQuery)Analyzes the search query and makes sure that it contains the required fields.
wchAdjustSitePagesSearchQuery(aQuery, aSiteId)Analyzes the search query and makes sure that it contains the required fields.
wchAuthoringElementFromAccessor(aAccessor, aType)Decodes the authoring element from the accessor expression
wchBoxFetchLevels(aLevels, aDefault)Returns the number of fetch levels
wchBoxLayoutMode(aMode)Maps unknown or empty modes
wchCreateUrlConfig(aBaseUrl, aApiUrl, aResourceUrl, aDocument)Constructs a interface based on some optional config values.
wchCycleHandling(aCycle)
wchDecodeAccessor(aPrototype, aAccessor)Tranlates the accessor to an expression
wchDecodeExpression(aExpression)Decodes the expression back to an expression into elements. The expression might point either to the optimized element or to the elements structure itself.
wchDeliveryContentByAccessor(aItem, aAccessor)Returns the element identified by the accessor string from a content item in delivery format
wchElementFromRenderingContext(aContext, aAccessor)Decodes an element from the accessor
wchForEachRenderingContext(aRenderingContext, aCallback)Iterates over all rendering contexts referenced by this context
wchForEachType(aType, aCallback)Resolves all typeRef
wchGetApiUrlFromResourceURL(aResourceURL)Computes the API URL given the resource URL
wchGetApiUrlInContext(aApiUrl, aBaseURL, aPreviewCheck)Constructs a API URL based on a context check callback
wchGetBaseURL(aDocument, aWindow)Decodes the base URL. The base URL is the URL that all routing URLs will start with and will be resolved as relative. The URL ends with a slash character. See .
wchGetHubInfoFromBaseURL(aBaseURL)Decodes the hub info from the base URL. This assumes that the application is served from a location in WCH.
wchGetHubInfoFromLinks(aDocument, aWindow)Decodes the hub info from links in the document
wchGetHubInfoUrlProvider(aApiUrl, aPreviewCheck)Exposes a provider based on a API URL and a preview callback
wchGetLayout(aLayoutMode, aContext)Returns the layout object for a particular mode for the rendering context
wchGetPageSearchURL(aPath, aSiteId)Returns the URI for a page search URL
wchGetParentPageURL(aParentId, aSiteId)Returns the URI for a parent page search
wchGetSearchURL(aQueryString)Builds the search query string
wchGetSiteContextURL(aParentId, aPageId, aSiteId)Returns the URI for a page search URL
wchInsertPlaceholders(aRenderingContext, aResolver)
wchIsPreviewMode(aBaseURL)Determines if the server is running in preview mode
wchPlaceholderFromAccessor(aAccessor, aType)Decodes the placeholder from an accessor expression
wchPlaceholderResolver(aTag, aSearch)Returns a resolver for placeholders based on WCH search
wchPrepareRenderingContextInterceptors(aRenderingContextInterceptors)Prepare a list of interceptors
wchResolveRenderingContext(aRenderingContext, aStrategy, aRenderingContextById, aLogger)Resolves the rendering context according to the configured strategy
wchResolveType(aType)Resolves all typeRef
wchSelectAccessor(aAccessor)parses a path expression
wchTypeFromAccessor(aAccessor, aType)Decodes the element type from an accessor expression

Interfaces

InterfaceDescription
Bind
BindKey
BindMember
ClientStorage
HttpOptions
HttpService
JSONArray
JSONObject
ObserverConsumer
Partial
RenderingContextInterceptors
RenderingContextMap
RxCompose
RxPipe
SpreadArgs
ZippedArgs

Variables

VariableDescription
andPerforms the "and" function
anyToString
arrayEqualsTests if two arrays are equal
arrayPushPushes a value to an array
assertArray
assertFromFunction
assertFromGenerator
assertObject
assignObject
authoringLayoutMappingToDeliveryLayoutMappingConverts an authoring layout item to a delivery layout item
authoringLayoutToDeliveryLayoutConverts an authoring layout item to a delivery layout item
authoringTypeToDeliveryTypeConverts an authoring layout item to a delivery layout item
biComposeRepresents the composition of two functions
biComposeMonoRepresents the composition of two functions where they have the same argument
binaryGuarantees a binary function
bindOur simple implementation
bindKeyThe bind member magic
bindMemberThe bind member magic
boxLoggerServiceFunction to return the NOOP_LOGGER service in case the logger service passed in is nil
byPropertyGenerates a predicate that compares a named property of an object with another predicate
cancelExecuteLater
cloneURLClones the URL object into a bean
cmpByLocalizedContextReturns a comparator that orders localizations according to the preferences of a localized context
cmpNumbersExports a comparator for numbers
cmpStringsExports a comparator for numbers
composeRepresents the composition of two functions
composeAllComposes the sequence of functions
constGenerator
createCacheConstructs a new cache
createConsoleLogger
createConsumerOnSubjectBinds to the next function of a subject
createEmptyLogger
createLruCacheConstructs a new cache
createObservableAdaptorConstructs an adaptor around an existing observable. This helps for cross frame access to observables.
createObserverConsumer
createSingleSubjectConstructs a singe replay subject
deepDistinctUntilChanged
deepEqualsTests if two objects are identical
DEFAULT_FETCH_LEVELS
DEFAULT_HTTP_RESOURCE_OPTIONS
DEFAULT_LAYOUT_MAPPING
DEFAULT_LAYOUT_MODE
EMPTY_JSON_OBSERVABLEThe empty observable instance, we can reuse the same
EMPTY_RENDERING_CONTEXT
EMPTY_SITE_CONTEXT
EMPTY_STRING_OBSERVABLEThe empty observable instance, we can reuse the same
escapeHtmlApplies HTML escaping to strings
executeLater
FALSE$Operator representing false
filterArrayOfReturns an operator function that filters array of a particular type
filterBoolean
filterNotNil
filterNumber
filterObject
filterString
filterTypeOfOnly returns objects of a particular type
firstElement
flipArgsswitch the order of arguments
fromGeneratorOrT
FUNCTION_TYPE
getCategoryLeafExtracts the last category element
getPathExtracts the value of the path for the property
getPropertyGenerates a function that returns a property
hashRandomClassNameReturns some random identifier
hashRandomIdentifierReturns some random identifier
hashRandomLinkNameReturns some random identifier
hashToClassNameConverts a hash number into a CSS class name
hashToIdentifierConverts a hash number into a javascript identifier
hashToLinkNameConverts a hash number into a javascript identifier
idleFrameScheduler
isAbsoluteURLTests if a URL is an absolute URL
isArrayTests if a value is an array
isArrayLikeTests if a value is like an array, i.e. it has the length property
isBooleanTests if a value is a boolean value
isDeepEqualToReturns a function that tests if a value is equal to another value
isEmptyTests if an array is empty
isEqualToReturns a function that tests if a value is equal to another value
isEqualVersionTests if two versions are equal
isFunctionTests if an object is a function
isNeverNever predicate, that never is true
isNilChecks for nil
isNilOrEmptyTests if the array does not exist or if it is empty
isNotEmptyTests if an array is not empty
isNotNilChecks for nil
isNumberTests if a value is a number value
isStringTests if an object is a string
isStringArrayTests if all elements of the array are of type string
isUndefinedChecks for undefined
jsonParse
jsonStringEscape
jsonStringify
KEY_CYCLE
KEY_LAYOUT_MODE
KEY_LEVELS
KEY_RENDERING_CONTEXT_MAP
KEY_RENDERING_CONTEXT
lastElement
LAYOUT_TYPE_ANGULAR
LAYOUT_TYPE_HANDLEBARS
lazyGeneratorCreates a lazy generator for the value
lazyProxyReturns an object that is lazily constructed when first accessed
localizedTextexpose a tuple as text
mapDefaultOperator that returns the default value for each nil value of the source sequence
mapTypeOfReturns the object if it is of a particular type, else undefined
mergeHubInfoMerges the config of two hub infos
MODULEModule name
NOOP_LOGGER_SERVICEFallback logger service that exposes noop loggers
notNegates a function
NULL$Operator representing undefined
nullaryGuarantees a nullary function
objectAssignAssigns a property to an object and returns that object
objectEqualsTests if two objects are equal
objectKeysMake sure we have some of the central functions
opBoxLayoutModeOperator to box the layout mode
opCacheLastConvenience operator for cacheLast()
opDeepDistinctUntilChangedLike using deepEquals
opDistinctUntilChangedLike
opFalseOperator representing false
opFilterBooleanFilters booleans
opFilterNeverFilter that will completely ignore all events
opFilterNotNilMakes sure the sequence does not have nils
opFilterNumberFilters number
opFilterObjectFilters plain objects
opFilterStringFilters strings
opJsonParseParses a string into a JSON object
opLevelsConverts the levels to a valid number value
opNotNegates a boolean
opPageArrayDistinctUntilChangedLike using pageArrayEquals()
opPageDistinctUntilChangedLike using pageEquals()
opPluckApiOriginExtracts the origin of the API URL from the rendering context
opPluckCurrentPageOperator to pluck the current page
opPluckDistinctPageOperator to pluck a distinct page
opPluckResourceOriginExtracts the origin of the Resource URL from the rendering context
opReplayLastConvenience operator for replayLast()
opShallowDistinctUntilChangedLike using shallowEquals
opShareLastShares and replays only the latest emission
opTrueOperator representing true
orPerforms the "or" function
pageArrayDistinctUntilChanged
pageDistinctUntilChanged
pageFromRenderingContextExtracts the selected page from the rendering context
parsePathOur parsing function, we assume that the resulting array is read only
parseURLParses a URL or string into a URL object
partialFirstBinds the first parameter
partialLeftOur simple implementation
partialSecondBinds the second parameter
pluckApiOriginExtracts the origin of the API URL from the rendering context
pluckCurrentPage
pluckLocaleAccessor for locales from a localized context
pluckPropertyGenerates a function that returns a property
pluckResourceOriginExtracts the origin of the Resource URL from the rendering context
pluckTextAccessor for text from a localized context
propertyFromObjectGenerates a function that returns a property
replayLastReturns the shareReplay operator with a buffer of 1 and refCount: true
rxCompose
rxErrorFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxLogReturns a function that logs particular aspects of a subscription
rxLogAllFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxLogMemberReturns a function that logs particular aspects of a subscription
rxLogNextFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxMemoizeOperator that caches the result of a previous operator and monitors the result for changes
rxNextFunction that perform an info logging in an rx pipeline onto a given logger with a particular prefix
rxPipeFunction that pipes the arguments to the stream passed as the first argument
rxPluckPathOperator to pluck a certain path
rxSelectPathMemoized selector for a particular path
rxSelectPropertyMemoized selector for a particular property
safeMergeMap
safeSwitchMap
safeUnsubscribeUnsubscribes if the subscription exists.
safeUnsubscribeAllUnsubscribes if the subscription exists.
SEARCH_MAX_ROWS
selectApiUrl
selectBaseUrl
selectPreviewMode
selectResourceUrl
shallowEqualsTests if two objects are identical
shareLast
spreadArgsWraps a function such that it accepts an array of parameters instead of individual parameters.
switchMapDefaultOperator that returns the default sequence for each nil value of the source sequence
ternaryPerforms the ternary operation
thisThenThatsCombines two observables such that the events on the first one are used until the second one starts to produce an event. From then on only the events on the second one will be used and the first one canceled.
toArrayConverts an array like to an array
TRUE$Operator representing true
typedPluckOperator that plucks a key from an object and makes sure that the key exists
unaryGuarantees a unary function
UNDEFINED_RENDERING_CONTEXT
UNDEFINED_TYPE
UNDEFINED$Operator representing undefined
VERSIONVersion and build number of the package
wchGetSiteURLReturns the URI path for the site
zipArgsExpose the array method in a strongly typed way

Type Aliases

Type AliasDescription
BiConsumer
BiFunction
CacheAccessor
CacheCallback
ComparatorComparison operator
Consumer
EqualsPredicate
Function0
Function1
Function2
Function3
Function4
Generator
GeneratorOrT
IsPredicate
JSONValue
MarkupTemplate
Maybemaybe type
ObservableOrT
ParsedQuery
PlaceholderResolverGiven a series of type IDs, return the placeholder content items
Predicate
Request

Home > @acoustic-content-sdk/utils > ClientStorageService

ClientStorageService class

Signature:

export declare class ClientStorageService implements ClientStorage 

Constructors

ConstructorModifiersDescription
(constructor)(aUrlsService, aWindow)Constructs a new instance of the ClientStorageService class

Properties

PropertyModifiersTypeDescription
get(aKey: string) => JSONValue
put(aKey: string, aValue: JSONValue) => void

Home > @acoustic-content-sdk/utils > SiteInformation

SiteInformation class

Signature:

export declare class SiteInformation 

Constructors

ConstructorModifiersDescription
(constructor)()Constructs a new instance of the SiteInformation class

Properties

PropertyModifiersTypeDescription
observerObserver<Site>
siteObservable<Site>Attaches the modifications on the current site

Methods

MethodModifiersDescription
getIdByPath(path)Returns an observable that communicates the content IDs of items for a particular path. If the mapping changes, the change will be propagated. If the mapping is unknown (because the site has not been loaded, yet) the m
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文