1.0.0 • Published 11 days ago

@wemnyelezxnpm/odit-nostrum-expedita v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
11 days ago

hermes

publish build npm npm codecov TypeScript

Javascript messaging library

Installation

npm i @wemnyelezxnpm/odit-nostrum-expedita or yarn add @wemnyelezxnpm/odit-nostrum-expedita

Usage

The main concept is sending messages via MessageClient's and answering them via MessageHost's.


Iframe

Send and recieve messages accross iframes and parent windows

// inside iframe
import { IframeMessageClient, Request } from '@wemnyelezxnpm/odit-nostrum-expedita/iframe';

class MessageSenderService extends IframeMessageClient {
  @Request('hello')
  public sayHello(name: string): Observable<string> {
    return null;
  }
}

const service = new MessageSenderService();

service.sayHello('John').subscribe(message => {
  console.log(message);
});

// 'Hi John, here are some data for you'
// 'Thales Rocks!!'
// inside parent window
import { IframeMessageHost, Listen, UpcomingMessage } from '@wemnyelezxnpm/odit-nostrum-expedita/iframe';
import { of } from 'rxjs';

class MessageListenerService extends IframeMessageHost {
  @Listen('hello')
  public listenHello({data, sender}: UpcomingMessage): Observable<string> {
    return of(
      'Hi ' + data + ', here is some data for you',
      'Thales Rocks!!'
    );
  }
}

const listener = new MessageListener();

Chrome Extensions

Send and recieve messages accross tabs, background-scripts, content-scripts etc.

// content-script or a page etc.
import { ChromeMessageClient, Request } from '@wemnyelezxnpm/odit-nostrum-expedita/chrome';

class MessageSenderService extends ChromeMessageClient {
  @Request('hello')
  public sayHello(name: string): Observable<string> {
    return null;
  }
}

const service = new MessageSenderService();

service.sayHello('John').subscribe(message => {
  console.log(message);
});

// 'Hi John, here are some data for you'
// 'Thales Rocks!!'
// background-script etc.
import { ChromeMessageHost, Listen } from '@wemnyelezxnpm/odit-nostrum-expedita/chrome';
import { of } from 'rxjs';

class MessageListenerService extends ChromeMessageHost {
  @Listen('hello')
  public listenHello(name: string): Observable<string> {
    return of(
      'Hi ' + name + ', here is some data for you',
      'Thales Rocks!!'
    );
  }
}

const listener = new MessageListener();

Workers

Implemented but not documented yet


Broadcast

Implemented but not documented yet

iteratepackage.jsonmochaposeexit-codeformfsxtermkoreankarmamodulejoiparseroptionupfigletprettyObject.fromEntriesdescriptorstableArray.prototype.includesreduceyamlwritereuseclirapidhandlersajvhttpObject.definePropertybcryptinternal slotmiddlewarelookextrapropertyinternalreactsameValueZeroserializationloadingrobustStreamsuninstallECMAScript 2021fast-copyprotobufwindowsspeedcall-bindajaxxdgsharedarraybuffermacosprefixstatelessqueueMicrotaskwebsiteidmkdirpmixinsmkdirsfantasy-landcomputed-typesStreampopmotionbundlerstartpatchvalidjQuerymakeObject.getPrototypeOftapeisConcatSpreadableprunefastifyauthenticationthrottlechannelECMAScript 2020istextwalkjsdeletetrimStart0matchestypeoffast-deep-clonecomparegroupArray.prototype.flatflattapmapfastthroatpurepostcss-pluginentriesauthemithookslessassertionvalidationexereact-hooksfile systemjsonpathregexarktype@@toStringTagfindES2019guidcheckcensorinstallerpicomatchbrowserdeterministicdeepcloneassertArrayBuffer.prototype.slicetakeMicrosoftArray.prototype.flatMaprmtyped arraytoSortedio-tsflattenWeakMappathcallObservablesArrayBufferextensionString.prototype.trimArrayBuffer#slicetoolkitcodesES2022Uint8ClampedArrayjsdomprocessformattinggetterinputtypecjkparentsrm -frlruRFC-6455promiseshookformeast-asian-widthObject.entriesstringbatchopenslazyfetchES2015postcssurlseslintpluginclassnameregexppreserve-symlinksprivatereadablestreammime-dbes2016datastructurevarcolores-shim APIcurlpackagesyntaxerrorjson-schema-validationArray.prototype.findLastIndex3dpasswordinferencevalidateoutputECMAScript 3rangeerrordotenvjavascriptArray.prototype.containssetterclassessymlinkreduxsharedgraphqlinstallbabeltraversestreamsreadyupmkdirchildReflect.getPrototypeOfhashflagspringdebuggersymlinksansivaluesasyncpyyamlpersistentobjectRxcollectioninterruptsmodulesminimalsomeeventDispatchercallboundirqequalityopenPromisehigher-orderhardlinkseslint-pluginstyleshasOwnUnderscoremake dirhttps$.extendgetPrototypeOfprotocontainsbootstrap cssshimbundlingreducerpackagesdatajasminexsshasbrowserliststylesheetperformantECMAScript 2022superstructbyteLengthserializeunicodees-shimsl10narraypromiseextendbufferconstlibphonenumberarraysdescriptorscss-in-jses2017iteratoranimationSymboles6ESnextES3toStringTagReactiveExtensionsutilityes5ECMAScript 2019getoptcurriedECMAScript 2018omitencryptionschemeargsSetclonepackage managerRxJSdragsyntaxtypescriptes8environmentimportthreevalueshrinkwrapsymbolseventEmitterbusytc39HyBiarraybuffersettingsprotocol-buffersfastcopyArray.prototype.findLastperformancestarterruntimeES2023sortsignalgetintrinsicchaienumerablea11yFloat64Arrayphoneprivate datafilenopeCSSStyleDeclarationmimetypescache_.extendincludesexecutableform-validationTypedArraysuperagentwaittoArrayeslintaccessorfindLastIndexi18ntestingbrowserslistshebangargumentsObject.valuesES2017propertiesawaitrgblaunchframeworkpnpm9signalsescapeassertsjson-schema-validatorArrayjwtexecinspecttypeerrorpropUint32Arraymulti-packagelockfilelintECMAScript 5Symbol.toStringTagcolumnsortedsigtermInt8Arraychromiumcolourassignes7fastclonedeepcopyconsoledateInt32Arrayenvbluebirdtslibecmascriptconcatlistenersfulleditorviewpolyfillbuffersreal-timeECMAScript 2017avatrimEndregular expressioncssPushgesturescollection.es6Object.keysTypeBoxclientreact poseArray.prototype.flattentypednoderedactcoerciblecharacteroperating-systemdirES2016siginttoobjectspinnerstaskes2018requireiecommanderECMAScript 2023code pointsfullwidthratelimitchinesejsdiffFloat32ArrayfunctionfpfindupReactiveXratefunctionscallbindObjectECMAScript 6typesESRegExp.prototype.flagswalkingpipeeventsless mixinsartconnectdependency managerECMAScript 7gdprstreams2ES8toolsoptimistgroupByerror-handlingstringifierES6removecss nestingvisualtermlimitwatchFileuser-streamscompilergetkey[[Prototype]]monorepoquerycorstranspileexpressionargumentwidthdropfromasciischemaequalslotgenericsmimeqsboundbootstrap lesssanitizewebcmduuidworkerzerodependenciesresolvejsxcallbackcorequeueoptimizerserializerpluginlanguagedirectoryES5StyleSheetWebSocketspawnreadablefunctionaljson-schemaUint16Arraytddzodless compilerwritablewhatwgbyteOffsetprototypewraputilsconcatMap6to5linewraplogginglesscsscall-boundutilitiesrm -rfweaksetquoteconfignested cssletmomentrmdirsymbolpreprocessorstyled-componentsoncemobileconfigurableJSON-SchemaaccessibilitystructuredCloneES7emojitypanionestreesanitizationdataViewidlemoveeslintconfigendercore-jsflagsMaperrorspecpoint-freenegative zerolimitedjapanesecolumnsworkspace:*sliceurlargvIteratorURLwatchingdom-testing-libraryURLSearchParamsawesomesaucewarningstylingargparseappsetPrototypeOfshammatchInt16Arraytranspilercharactersindicator-0babel-coreCSSgradients css3trimLeftbreakcss less__proto__ECMAScript 2016setcommand-lineimmutablemergeObservableesdomutilcopy256sequencejsonvariables in cssintrinsicparentlinuxclassnamesString.prototype.matchAllglobchromeinvariantFunction.prototype.namebyteramdaBigInt64ArrayfindLastrecursiveAsyncIteratorstylereact animationObject.isfind-upharmonyimmerWebSocketsfixed-widthcryptoObject.assignlogduplexwaapiES2018trimtestfseventstrimRightdefineutil.inspectframernameloggeroffsetregular expressionscirculartouchopenerairbnbtimeforEachparseeverysearchtypesafefilterregulartesterECMAScript 2015defaultdayjskeysrequestcompile lesststtyconcurrencycss variablevalidatorfast-cloneweakmapformscryptlook-upbindWeakSetES2020jestscheme-validationsetImmediatexdg-openwordwrapbannernodejsconsumecreatereact-testing-libraryautoprefixerUint8ArraydefinePropertyexitfast-deep-copyclass-validatorefficientshellwhichwatchercommanddebugdataviewapisafeArray.prototype.filterBigUint64Arrayelectronreact-hook-formterminalrfc4122progresscolorsnegativeponyfillformatES2021TypeScriptRegExp#flagsJSON
1.0.0

11 days ago