🌈 A very simple window communication library

Overview

window-channel

A very simple window communication library.

GitHub stars

Get Start!


Install

npm install @haiyaotec/window-channel

Usage/Examples

Client

    import {WindowChannel} from '@haiyaotec/window-channel'
    let client = WindowChannel.newChannelClient(window,iFrame.contentWindow,"*")
    function f() {
        client.request('/hello', '客户端发送的消息', 1000)
            .then((value) => {
                console.log(value)
            })
            .catch((err) => {
                console.log(err)
            })
    }
    setInterval(f,3000)

Server

import {WindowChannel} from '@haiyaotec/window-channel'
let service=WindowChannel.newChannelService(window)

service.listen('/hello',(value)=>{
    console.log(value)
    return '服务端发送的消息'
})

service.observe('/dingyue',()=>{
    console.log('订阅成功')
})

setTimeout(()=>{
    service.broadcast('/dingyue','聊天室广播内容')
},20000)

License

MIT License © 2021-Present YuDong Su

You might also like...

An simple package to create an Activity in Discord Voice Channel using Discord.js

An simple package to create an Activity in Discord Voice Channel using Discord.js

discordjs-activity An simple package to create an Activity in Discord Voice Channel using Discord.js 📂 | Installation npm install discordjs-activity

Nov 15, 2022

Simple activity indicator for StimulusReflex (for Turbo/Turbolinks-enabled applications)

StimulusReflex Activity Indicator Uses the Turbo(links) progress bar to display activity while morphing. CleanShot.2021-07-23.at.12.04.05.mp4 Installa

May 26, 2022

A simple Facebook Messenger Bot like Discord Was Made By Me(CatalizCS) And My Brother SpermLord

A simple Facebook Messenger Bot like Discord Was Made By Me(CatalizCS) And My Brother SpermLord

MiraiBot A simple Facebook Messenger Bot made by me(CatalizCS) and my brother SpermLord. Report Bug · Request Feature Table of Contents Giới thiệu Hướ

Jan 2, 2023

A simple Multi Guild Modmail Bot coded in v13 using the enmap Database Working on any host, like repl.it or vps! Its fast and working bug free + Security options!

Multiguild-Modmail A simple Multi Guild Modmail Bot coded in v13 using the enmap Database Working on any host, like repl.it or vps! Its fast and worki

Oct 20, 2022

A simple discord bot that can execute commands to your termux.

A simple discord bot that can execute commands to your termux.

Termux-Bot It's a simple discord bot that can execute commands to your termux. Try it for yourselves Requirements discord account and bot, npm, git, o

Oct 5, 2022

Simple Discord Bot :)

Simple Discord Bot :)

HackBot Zielino | 27-09-2021 HackBot - Discord Bot with Network commands such as Redirect checking Includes Database Logging Debug, Warns, and Errors

Nov 21, 2022

Discord Music Made Simple.

boat-discord Inspiration This project was made because of the shutdown of Groovy and Rhythm. This project was inspired by the connecting two APIs work

Nov 9, 2022

A simple & easy2use API for obtaining information about a discord user, discord bot or discord guild and their use for some purpose on websites!

discord-web-api A simple & easy2use API for obtaining information about a discord user, discord bot or discord guild and their use for some purpose on

Jun 28, 2022

A Simple Discord.js Slash Commands For You 3

Simple Discord.js Slash Commands For You NPM Install You Need : Node.js v16+ Discord.js Dotenv Mongoose Visual Studio Code ( Ye Code Editor K Man Az V

Jun 2, 2022
I’m a very useful music bot that can make you play a music with a simple command! I have a lot of good commands that you can have a better experience playing your favorites songs!

I’m a very useful music bot that can make you play a music with a simple command! I have a lot of good commands that you can have a better experience playing your favorites songs!

Hugo Kishi 2 Aug 16, 2022
Simple command handler by recon.. all credits to them. I just made it simple for others to use

Discord.js-v13-commandhandler An advanced command handler adapted from reconlx command handler and upgraded with more feature such as permission handl

Ventispurr 3 May 11, 2022
A simple library for using the JavaScript Full Screen API.

BigScreen A simple library for using the JavaScript Fullscreen API. Why should I use it? BigScreen makes it easy to use full screen on your site or in

Brad Dougherty 712 Dec 22, 2022
A simple bot for twitch, which has a silly AI in places. The library "cleverbot-free" is used for AI.

AITwitchChat A simple bot for twitch, which has a silly AI in places. The library "cleverbot-free" is used for AI. Requiments tmi.js Node.js 16.6.0 or

DesConnet 4 Dec 7, 2022
Aviatojs - A simple library to trim, cut and join audio files.

Aviatojs A simple library to trim, cut and join audio files. Usage For a fully working example refer to this example Importing import {AviatoAudio}

null 6 Oct 7, 2022
This is a simple web based media player for playing video and audio. Build with pure HTML, CSS and Javascript. No framework or library included.

Aim-Player This is a simple web based media player for playing video and audio. Build with pure HTML, CSS and Javascript. No framework or library incl

Aim Mikel 2 Jun 27, 2021
A simple HTML5, YouTube and Vimeo player

Plyr is a simple, lightweight, accessible and customizable HTML5, YouTube and Vimeo media player that supports modern browsers. Checkout the demo - Do

Sam Potts 23.1k Jan 3, 2023
A simple package to download music tracks from spotify 🎵

A simple package to download music tracks from spotify ??

Alen Yohannan 26 Dec 25, 2022
Simple general purpose Discord Bot Generator

Welcome to HYMITY ?? Simple general purpose Discord Bot Generator ?? Homepage Prerequisites Knowledge in coding! Know how to make Discord Application

Sarvesh M Rao 3 Jul 3, 2022
This is a simple NQN bot with JavaScript

Discord Nqn Bot This is a simple NQN bot with JavaScript Tested With Node.js Setup ?? Import the Repo by typing git clone https://github.com/Just-Msv/

M s v 7 Sep 8, 2021