@yehn/core
TypeScript icon, indicating that this package has built-in type declarations

3.0.5 • Public • Published

Yehn

This repository is part of the source code of Yehn. You can find more information at yehn.io or by contacting opensource@yehn.io.

You can find the published source code at github.com/yehnhq/yehn.

For licensing information, see the attached LICENSE file and the list of third-party licenses at yehn.io/legal/licenses/.

Core

Yehn for Web's communication core.

Example

yarn add @yehn/core

JavaScript (Node.js)

const {Account} = require('@yehn/core');

const account = new Account();

account.on(Account.INCOMING.TEXT_MESSAGE, ({conversation, content}) => {
  account.service.conversation.sendTextMessage(conversation, `Echo: ${content}`);
});

account.listen({
  clientType: 'temporary',
  email: 'name@email.com',
  password: 'secret',
});

TypeScript

import {Account} from '@yehn/core';
import {PayloadBundle} from '@yehn/core/dist/commonjs/cryptography/';
import {ClientType} from '@yehn/api-client/dist/commonjs/client/';
import {LoginData} from '@yehn/api-client/dist/commonjs/auth/';

const account: Account = new Account();

const login: LoginData = {
  clientType: ClientType.TEMPORARY,
  email: 'name@email.com',
  password: 'secret',
};

account.on(Account.INCOMING.TEXT_MESSAGE, (data: PayloadBundle) => {
  account.service.conversation.sendTextMessage(data.conversation, data.content);
});

account.listen(login).catch(error => {
  console.error(error.stack);
  return process.exit(1);
});

Readme

Keywords

none

Package Sidebar

Install

npm i @yehn/core

Weekly Downloads

0

Version

3.0.5

License

GPL-3.0

Unpacked Size

3.36 kB

Total Files

2

Last publish

Collaborators

  • yehn-owner