@acoustic-content-sdk/utils 中文文档教程
主页 > @acoustic-content-sdk/utils
utils package
此库包含一组实用函数,可帮助针对 [Watson Content Hub](https://www.ibm. com/products/watson-content-hub)。
一些函数是非常通用的辅助函数。 我们使用它们代替“lodash”来减小尺寸并提高速度。
Classes
Class | Description |
---|---|
ClientStorageService | |
SiteInformation | |
StaticResources | Accessor for static resources, placed next to the application |
Enumerations
Enumeration | Description |
---|---|
ItemStatus | |
RxLogger | Checks what to log |
Functions
Function | Description |
---|---|
_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
Variables
Variable | Description |
---|---|
and | Performs the "and" function |
anyToString | |
arrayEquals | Tests if two arrays are equal |
arrayPush | Pushes a value to an array |
assertArray | |
assertFromFunction | |
assertFromGenerator | |
assertObject | |
assignObject | |
authoringLayoutMappingToDeliveryLayoutMapping | Converts an authoring layout item to a delivery layout item |
authoringLayoutToDeliveryLayout | Converts an authoring layout item to a delivery layout item |
authoringTypeToDeliveryType | Converts an authoring layout item to a delivery layout item |
biCompose | Represents the composition of two functions |
biComposeMono | Represents the composition of two functions where they have the same argument |
binary | Guarantees a binary function |
bind | Our simple implementation |
bindKey | The bind member magic |
bindMember | The bind member magic |
boxLoggerService | Function to return the NOOP_LOGGER service in case the logger service passed in is nil |
byProperty | Generates a predicate that compares a named property of an object with another predicate |
cancelExecuteLater | |
cloneURL | Clones the URL object into a bean |
cmpByLocalizedContext | Returns a comparator that orders localizations according to the preferences of a localized context |
cmpNumbers | Exports a comparator for numbers |
cmpStrings | Exports a comparator for numbers |
compose | Represents the composition of two functions |
composeAll | Composes the sequence of functions |
constGenerator | |
createCache | Constructs a new cache |
createConsoleLogger | |
createConsumerOnSubject | Binds to the next function of a subject |
createEmptyLogger | |
createLruCache | Constructs a new cache |
createObservableAdaptor | Constructs an adaptor around an existing observable. This helps for cross frame access to observables. |
createObserverConsumer | |
createSingleSubject | Constructs a singe replay subject |
deepDistinctUntilChanged | |
deepEquals | Tests if two objects are identical |
DEFAULT_FETCH_LEVELS | |
DEFAULT_HTTP_RESOURCE_OPTIONS | |
DEFAULT_LAYOUT_MAPPING | |
DEFAULT_LAYOUT_MODE | |
EMPTY_JSON_OBSERVABLE | The empty observable instance, we can reuse the same |
EMPTY_RENDERING_CONTEXT | |
EMPTY_SITE_CONTEXT | |
EMPTY_STRING_OBSERVABLE | The empty observable instance, we can reuse the same |
escapeHtml | Applies HTML escaping to strings |
executeLater | |
FALSE$ | Operator representing false |
filterArrayOf | Returns an operator function that filters array of a particular type |
filterBoolean | |
filterNotNil | |
filterNumber | |
filterObject | |
filterString | |
filterTypeOf | Only returns objects of a particular type |
firstElement | |
flipArgs | switch the order of arguments |
fromGeneratorOrT | |
FUNCTION_TYPE | |
getCategoryLeaf | Extracts the last category element |
getPath | Extracts the value of the path for the property |
getProperty | Generates a function that returns a property |
hashRandomClassName | Returns some random identifier |
hashRandomIdentifier | Returns some random identifier |
hashRandomLinkName | Returns some random identifier |
hashToClassName | Converts a hash number into a CSS class name |
hashToIdentifier | Converts a hash number into a javascript identifier |
hashToLinkName | Converts a hash number into a javascript identifier |
idleFrameScheduler | |
isAbsoluteURL | Tests if a URL is an absolute URL |
isArray | Tests if a value is an array |
isArrayLike | Tests if a value is like an array, i.e. it has the length property |
isBoolean | Tests if a value is a boolean value |
isDeepEqualTo | Returns a function that tests if a value is equal to another value |
isEmpty | Tests if an array is empty |
isEqualTo | Returns a function that tests if a value is equal to another value |
isEqualVersion | Tests if two versions are equal |
isFunction | Tests if an object is a function |
isNever | Never predicate, that never is true |
isNil | Checks for nil |
isNilOrEmpty | Tests if the array does not exist or if it is empty |
isNotEmpty | Tests if an array is not empty |
isNotNil | Checks for nil |
isNumber | Tests if a value is a number value |
isString | Tests if an object is a string |
isStringArray | Tests if all elements of the array are of type string |
isUndefined | Checks 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 | |
lazyGenerator | Creates a lazy generator for the value |
lazyProxy | Returns an object that is lazily constructed when first accessed |
localizedText | expose a tuple as text |
mapDefault | Operator that returns the default value for each nil value of the source sequence |
mapTypeOf | Returns the object if it is of a particular type, else undefined |
mergeHubInfo | Merges the config of two hub infos |
MODULE | Module name |
NOOP_LOGGER_SERVICE | Fallback logger service that exposes noop loggers |
not | Negates a function |
NULL$ | Operator representing undefined |
nullary | Guarantees a nullary function |
objectAssign | Assigns a property to an object and returns that object |
objectEquals | Tests if two objects are equal |
objectKeys | Make sure we have some of the central functions |
opBoxLayoutMode | Operator to box the layout mode |
opCacheLast | Convenience operator for cacheLast() |
opDeepDistinctUntilChanged | Like using deepEquals |
opDistinctUntilChanged | Like |
opFalse | Operator representing false |
opFilterBoolean | Filters booleans |
opFilterNever | Filter that will completely ignore all events |
opFilterNotNil | Makes sure the sequence does not have nils |
opFilterNumber | Filters number |
opFilterObject | Filters plain objects |
opFilterString | Filters strings |
opJsonParse | Parses a string into a JSON object |
opLevels | Converts the levels to a valid number value |
opNot | Negates a boolean |
opPageArrayDistinctUntilChanged | Like using pageArrayEquals() |
opPageDistinctUntilChanged | Like using pageEquals() |
opPluckApiOrigin | Extracts the origin of the API URL from the rendering context |
opPluckCurrentPage | Operator to pluck the current page |
opPluckDistinctPage | Operator to pluck a distinct page |
opPluckResourceOrigin | Extracts the origin of the Resource URL from the rendering context |
opReplayLast | Convenience operator for replayLast() |
opShallowDistinctUntilChanged | Like using shallowEquals |
opShareLast | Shares and replays only the latest emission |
opTrue | Operator representing true |
or | Performs the "or" function |
pageArrayDistinctUntilChanged | |
pageDistinctUntilChanged | |
pageFromRenderingContext | Extracts the selected page from the rendering context |
parsePath | Our parsing function, we assume that the resulting array is read only |
parseURL | Parses a URL or string into a URL object |
partialFirst | Binds the first parameter |
partialLeft | Our simple implementation |
partialSecond | Binds the second parameter |
pluckApiOrigin | Extracts the origin of the API URL from the rendering context |
pluckCurrentPage | |
pluckLocale | Accessor for locales from a localized context |
pluckProperty | Generates a function that returns a property |
pluckResourceOrigin | Extracts the origin of the Resource URL from the rendering context |
pluckText | Accessor for text from a localized context |
propertyFromObject | Generates a function that returns a property |
replayLast | Returns the shareReplay operator with a buffer of 1 and refCount: true |
rxCompose | |
rxError | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxLog | Returns a function that logs particular aspects of a subscription |
rxLogAll | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxLogMember | Returns a function that logs particular aspects of a subscription |
rxLogNext | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxMemoize | Operator that caches the result of a previous operator and monitors the result for changes |
rxNext | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxPipe | Function that pipes the arguments to the stream passed as the first argument |
rxPluckPath | Operator to pluck a certain path |
rxSelectPath | Memoized selector for a particular path |
rxSelectProperty | Memoized selector for a particular property |
safeMergeMap | |
safeSwitchMap | |
safeUnsubscribe | Unsubscribes if the subscription exists. |
safeUnsubscribeAll | Unsubscribes if the subscription exists. |
SEARCH_MAX_ROWS | |
selectApiUrl | |
selectBaseUrl | |
selectPreviewMode | |
selectResourceUrl | |
shallowEquals | Tests if two objects are identical |
shareLast | |
spreadArgs | Wraps a function such that it accepts an array of parameters instead of individual parameters. |
switchMapDefault | Operator that returns the default sequence for each nil value of the source sequence |
ternary | Performs the ternary operation |
thisThenThats | 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. |
toArray | Converts an array like to an array |
TRUE$ | Operator representing true |
typedPluck | Operator that plucks a key from an object and makes sure that the key exists |
unary | Guarantees a unary function |
UNDEFINED_RENDERING_CONTEXT | |
UNDEFINED_TYPE | |
UNDEFINED$ | Operator representing undefined |
VERSION | Version and build number of the package |
wchGetSiteURL | Returns the URI path for the site |
zipArgs | Expose the array method in a strongly typed way |
Type Aliases
Type Alias | Description |
---|---|
BiConsumer | |
BiFunction | |
CacheAccessor | |
CacheCallback | |
Comparator | Comparison operator |
Consumer | |
EqualsPredicate | |
Function0 | |
Function1 | |
Function2 | |
Function3 | |
Function4 | |
Generator | |
GeneratorOrT | |
IsPredicate | |
JSONValue | |
MarkupTemplate | |
Maybe | maybe type |
ObservableOrT | |
ParsedQuery | |
PlaceholderResolver | Given 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
Constructor | Modifiers | Description |
---|---|---|
(constructor)(aUrlsService, aWindow) | Constructs a new instance of the ClientStorageService class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
get | (aKey: string) => JSONValue | ||
put | (aKey: string, aValue: JSONValue) => void |
Home > ; @acoustic-content-sdk/utils > 站点信息
SiteInformation class
签名:
export declare class SiteInformation
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)() | Constructs a new instance of the SiteInformation class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
observer | Observer<Site> | ||
site | Observable<Site> | Attaches the modifications on the current site |
Methods
Method | Modifiers | Description |
---|---|---|
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 |
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
Class | Description |
---|---|
ClientStorageService | |
SiteInformation | |
StaticResources | Accessor for static resources, placed next to the application |
Enumerations
Enumeration | Description |
---|---|
ItemStatus | |
RxLogger | Checks what to log |
Functions
Function | Description |
---|---|
_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
Variables
Variable | Description |
---|---|
and | Performs the "and" function |
anyToString | |
arrayEquals | Tests if two arrays are equal |
arrayPush | Pushes a value to an array |
assertArray | |
assertFromFunction | |
assertFromGenerator | |
assertObject | |
assignObject | |
authoringLayoutMappingToDeliveryLayoutMapping | Converts an authoring layout item to a delivery layout item |
authoringLayoutToDeliveryLayout | Converts an authoring layout item to a delivery layout item |
authoringTypeToDeliveryType | Converts an authoring layout item to a delivery layout item |
biCompose | Represents the composition of two functions |
biComposeMono | Represents the composition of two functions where they have the same argument |
binary | Guarantees a binary function |
bind | Our simple implementation |
bindKey | The bind member magic |
bindMember | The bind member magic |
boxLoggerService | Function to return the NOOP_LOGGER service in case the logger service passed in is nil |
byProperty | Generates a predicate that compares a named property of an object with another predicate |
cancelExecuteLater | |
cloneURL | Clones the URL object into a bean |
cmpByLocalizedContext | Returns a comparator that orders localizations according to the preferences of a localized context |
cmpNumbers | Exports a comparator for numbers |
cmpStrings | Exports a comparator for numbers |
compose | Represents the composition of two functions |
composeAll | Composes the sequence of functions |
constGenerator | |
createCache | Constructs a new cache |
createConsoleLogger | |
createConsumerOnSubject | Binds to the next function of a subject |
createEmptyLogger | |
createLruCache | Constructs a new cache |
createObservableAdaptor | Constructs an adaptor around an existing observable. This helps for cross frame access to observables. |
createObserverConsumer | |
createSingleSubject | Constructs a singe replay subject |
deepDistinctUntilChanged | |
deepEquals | Tests if two objects are identical |
DEFAULT_FETCH_LEVELS | |
DEFAULT_HTTP_RESOURCE_OPTIONS | |
DEFAULT_LAYOUT_MAPPING | |
DEFAULT_LAYOUT_MODE | |
EMPTY_JSON_OBSERVABLE | The empty observable instance, we can reuse the same |
EMPTY_RENDERING_CONTEXT | |
EMPTY_SITE_CONTEXT | |
EMPTY_STRING_OBSERVABLE | The empty observable instance, we can reuse the same |
escapeHtml | Applies HTML escaping to strings |
executeLater | |
FALSE$ | Operator representing false |
filterArrayOf | Returns an operator function that filters array of a particular type |
filterBoolean | |
filterNotNil | |
filterNumber | |
filterObject | |
filterString | |
filterTypeOf | Only returns objects of a particular type |
firstElement | |
flipArgs | switch the order of arguments |
fromGeneratorOrT | |
FUNCTION_TYPE | |
getCategoryLeaf | Extracts the last category element |
getPath | Extracts the value of the path for the property |
getProperty | Generates a function that returns a property |
hashRandomClassName | Returns some random identifier |
hashRandomIdentifier | Returns some random identifier |
hashRandomLinkName | Returns some random identifier |
hashToClassName | Converts a hash number into a CSS class name |
hashToIdentifier | Converts a hash number into a javascript identifier |
hashToLinkName | Converts a hash number into a javascript identifier |
idleFrameScheduler | |
isAbsoluteURL | Tests if a URL is an absolute URL |
isArray | Tests if a value is an array |
isArrayLike | Tests if a value is like an array, i.e. it has the length property |
isBoolean | Tests if a value is a boolean value |
isDeepEqualTo | Returns a function that tests if a value is equal to another value |
isEmpty | Tests if an array is empty |
isEqualTo | Returns a function that tests if a value is equal to another value |
isEqualVersion | Tests if two versions are equal |
isFunction | Tests if an object is a function |
isNever | Never predicate, that never is true |
isNil | Checks for nil |
isNilOrEmpty | Tests if the array does not exist or if it is empty |
isNotEmpty | Tests if an array is not empty |
isNotNil | Checks for nil |
isNumber | Tests if a value is a number value |
isString | Tests if an object is a string |
isStringArray | Tests if all elements of the array are of type string |
isUndefined | Checks 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 | |
lazyGenerator | Creates a lazy generator for the value |
lazyProxy | Returns an object that is lazily constructed when first accessed |
localizedText | expose a tuple as text |
mapDefault | Operator that returns the default value for each nil value of the source sequence |
mapTypeOf | Returns the object if it is of a particular type, else undefined |
mergeHubInfo | Merges the config of two hub infos |
MODULE | Module name |
NOOP_LOGGER_SERVICE | Fallback logger service that exposes noop loggers |
not | Negates a function |
NULL$ | Operator representing undefined |
nullary | Guarantees a nullary function |
objectAssign | Assigns a property to an object and returns that object |
objectEquals | Tests if two objects are equal |
objectKeys | Make sure we have some of the central functions |
opBoxLayoutMode | Operator to box the layout mode |
opCacheLast | Convenience operator for cacheLast() |
opDeepDistinctUntilChanged | Like using deepEquals |
opDistinctUntilChanged | Like |
opFalse | Operator representing false |
opFilterBoolean | Filters booleans |
opFilterNever | Filter that will completely ignore all events |
opFilterNotNil | Makes sure the sequence does not have nils |
opFilterNumber | Filters number |
opFilterObject | Filters plain objects |
opFilterString | Filters strings |
opJsonParse | Parses a string into a JSON object |
opLevels | Converts the levels to a valid number value |
opNot | Negates a boolean |
opPageArrayDistinctUntilChanged | Like using pageArrayEquals() |
opPageDistinctUntilChanged | Like using pageEquals() |
opPluckApiOrigin | Extracts the origin of the API URL from the rendering context |
opPluckCurrentPage | Operator to pluck the current page |
opPluckDistinctPage | Operator to pluck a distinct page |
opPluckResourceOrigin | Extracts the origin of the Resource URL from the rendering context |
opReplayLast | Convenience operator for replayLast() |
opShallowDistinctUntilChanged | Like using shallowEquals |
opShareLast | Shares and replays only the latest emission |
opTrue | Operator representing true |
or | Performs the "or" function |
pageArrayDistinctUntilChanged | |
pageDistinctUntilChanged | |
pageFromRenderingContext | Extracts the selected page from the rendering context |
parsePath | Our parsing function, we assume that the resulting array is read only |
parseURL | Parses a URL or string into a URL object |
partialFirst | Binds the first parameter |
partialLeft | Our simple implementation |
partialSecond | Binds the second parameter |
pluckApiOrigin | Extracts the origin of the API URL from the rendering context |
pluckCurrentPage | |
pluckLocale | Accessor for locales from a localized context |
pluckProperty | Generates a function that returns a property |
pluckResourceOrigin | Extracts the origin of the Resource URL from the rendering context |
pluckText | Accessor for text from a localized context |
propertyFromObject | Generates a function that returns a property |
replayLast | Returns the shareReplay operator with a buffer of 1 and refCount: true |
rxCompose | |
rxError | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxLog | Returns a function that logs particular aspects of a subscription |
rxLogAll | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxLogMember | Returns a function that logs particular aspects of a subscription |
rxLogNext | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxMemoize | Operator that caches the result of a previous operator and monitors the result for changes |
rxNext | Function that perform an info logging in an rx pipeline onto a given logger with a particular prefix |
rxPipe | Function that pipes the arguments to the stream passed as the first argument |
rxPluckPath | Operator to pluck a certain path |
rxSelectPath | Memoized selector for a particular path |
rxSelectProperty | Memoized selector for a particular property |
safeMergeMap | |
safeSwitchMap | |
safeUnsubscribe | Unsubscribes if the subscription exists. |
safeUnsubscribeAll | Unsubscribes if the subscription exists. |
SEARCH_MAX_ROWS | |
selectApiUrl | |
selectBaseUrl | |
selectPreviewMode | |
selectResourceUrl | |
shallowEquals | Tests if two objects are identical |
shareLast | |
spreadArgs | Wraps a function such that it accepts an array of parameters instead of individual parameters. |
switchMapDefault | Operator that returns the default sequence for each nil value of the source sequence |
ternary | Performs the ternary operation |
thisThenThats | 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. |
toArray | Converts an array like to an array |
TRUE$ | Operator representing true |
typedPluck | Operator that plucks a key from an object and makes sure that the key exists |
unary | Guarantees a unary function |
UNDEFINED_RENDERING_CONTEXT | |
UNDEFINED_TYPE | |
UNDEFINED$ | Operator representing undefined |
VERSION | Version and build number of the package |
wchGetSiteURL | Returns the URI path for the site |
zipArgs | Expose the array method in a strongly typed way |
Type Aliases
Type Alias | Description |
---|---|
BiConsumer | |
BiFunction | |
CacheAccessor | |
CacheCallback | |
Comparator | Comparison operator |
Consumer | |
EqualsPredicate | |
Function0 | |
Function1 | |
Function2 | |
Function3 | |
Function4 | |
Generator | |
GeneratorOrT | |
IsPredicate | |
JSONValue | |
MarkupTemplate | |
Maybe | maybe type |
ObservableOrT | |
ParsedQuery | |
PlaceholderResolver | Given 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
Constructor | Modifiers | Description |
---|---|---|
(constructor)(aUrlsService, aWindow) | Constructs a new instance of the ClientStorageService class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
get | (aKey: string) => JSONValue | ||
put | (aKey: string, aValue: JSONValue) => void |
Home > @acoustic-content-sdk/utils > SiteInformation
SiteInformation class
Signature:
export declare class SiteInformation
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)() | Constructs a new instance of the SiteInformation class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
observer | Observer<Site> | ||
site | Observable<Site> | Attaches the modifications on the current site |
Methods
Method | Modifiers | Description |
---|---|---|
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 |