プロジェクト
概要
ローカルストレージを通信チャネルとして使用
その他のプロジェクト計測したスター増加
- 24時間
- 0
- 7日間
- 0
- 15日間
- 0
- 1か月
- 履歴を収集中
期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。
README.md
オリジナルThe Local Storage Bridge
1K library for exchanging messages between tabs in a same browser. It uses the local storage as a communication channel.
The story behind the library is available here.
Usage
Add lsbridge.min.js to your page:
<script src="js/lsbridge.min.js"></script>
There is a global object lsbridge available.
Send messages:
lsbridge.send('my-namespace', { message: 'Hello world!' });
Listen for messages:
lsbridge.subscribe('my-namespace', function(data) {
console.log(data); // prints: { message: 'Hello world!'}
});
Find out if localStorage is available:
console.log(lsbridge.isLSAvailable); // prints "true" or "false"
Cancel listeners for specific namespace:
lsbridge.unsubscribe('my-namespace');
Compilation
- Run
npm installto get UglifyJS installed. - Run
npm run-script compileto producebuild/jsbridge.min.js
Example
Try it yourself by opening example/index.html in a browser.

関連プロジェクトを探す
読み込み中…