Showing preview only (3,857K chars total). Download the full file or copy to clipboard to get everything.
Repository: amark/gun
Branch: master
Commit: ed27b48569ef
Files: 571
Total size: 3.6 MB
Directory structure:
gitextract_sxejevxy/
├── .dockerignore
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .npmignore
├── .prettierignore
├── .travis.yml
├── CHANGELOG.md
├── Dockerfile
├── LICENSE.md
├── Procfile
├── README.md
├── RELEASE.md
├── SECURITY.md
├── app.json
├── as.js
├── axe.js
├── bower.json
├── browser.js
├── examples/
│ ├── .gitignore
│ ├── Main.js
│ ├── angular/
│ │ ├── .angular-cli.json
│ │ ├── .editorconfig
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── e2e/
│ │ │ ├── app.e2e-spec.ts
│ │ │ ├── app.po.ts
│ │ │ └── tsconfig.e2e.json
│ │ ├── example_package.json
│ │ ├── karma.conf.js
│ │ ├── protractor.conf.js
│ │ ├── server.js
│ │ ├── src/
│ │ │ ├── app/
│ │ │ │ ├── app.component.css
│ │ │ │ ├── app.component.html
│ │ │ │ ├── app.component.spec.ts
│ │ │ │ ├── app.component.ts
│ │ │ │ ├── app.module.ts
│ │ │ │ ├── gun.helper.ts
│ │ │ │ └── gun.service.ts
│ │ │ ├── assets/
│ │ │ │ └── .gitkeep
│ │ │ ├── environments/
│ │ │ │ ├── environment.prod.ts
│ │ │ │ └── environment.ts
│ │ │ ├── index.html
│ │ │ ├── main.ts
│ │ │ ├── polyfills.ts
│ │ │ ├── styles.css
│ │ │ ├── test.ts
│ │ │ ├── tsconfig.app.json
│ │ │ ├── tsconfig.spec.json
│ │ │ └── typings.d.ts
│ │ ├── tsconfig.json
│ │ └── tslint.json
│ ├── axe.html
│ ├── basic/
│ │ ├── chat.html
│ │ ├── emoji.html
│ │ ├── meet.html
│ │ ├── note.html
│ │ ├── paste.html
│ │ ├── poll.html
│ │ ├── post.html
│ │ ├── private.html
│ │ ├── schedule.html
│ │ ├── screen.html
│ │ ├── stream.html
│ │ ├── tables.html
│ │ ├── upload.html
│ │ ├── user.html
│ │ └── video.html
│ ├── chat/
│ │ ├── index.html
│ │ └── user.html
│ ├── contact/
│ │ └── index.html
│ ├── docs.html
│ ├── express.js
│ ├── game/
│ │ ├── furball.html
│ │ ├── nts.html
│ │ ├── space.html
│ │ └── win.html
│ ├── hapi.js
│ ├── http.js
│ ├── https.sh
│ ├── index.html
│ ├── infinite-scroll/
│ │ ├── ScrollWindow.js
│ │ ├── index.html
│ │ ├── index.js
│ │ └── style.css
│ ├── install.sh
│ ├── jquery.js
│ ├── json/
│ │ └── index.html
│ ├── move/
│ │ └── index.html
│ ├── party.html
│ ├── react/
│ │ ├── README.md
│ │ ├── public/
│ │ │ └── index.html
│ │ ├── src/
│ │ │ ├── App.js
│ │ │ ├── App.test.js
│ │ │ ├── Chat.js
│ │ │ ├── Json.js
│ │ │ ├── Todos.js
│ │ │ ├── index.css
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ └── todo.html
│ ├── react-native/
│ │ ├── .babelrc
│ │ ├── .buckconfig
│ │ ├── .flowconfig
│ │ ├── .gitattributes
│ │ ├── .gitignore
│ │ ├── .watchmanconfig
│ │ ├── README.md
│ │ ├── android/
│ │ │ ├── app/
│ │ │ │ ├── BUCK
│ │ │ │ ├── build.gradle
│ │ │ │ ├── proguard-rules.pro
│ │ │ │ └── src/
│ │ │ │ └── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── assets/
│ │ │ │ │ └── html/
│ │ │ │ │ └── blank.html
│ │ │ │ ├── java/
│ │ │ │ │ └── com/
│ │ │ │ │ └── gundemo/
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MainApplication.java
│ │ │ │ └── res/
│ │ │ │ └── values/
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── build.gradle
│ │ │ ├── gradle/
│ │ │ │ └── wrapper/
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradle.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── keystores/
│ │ │ │ ├── BUCK
│ │ │ │ └── debug.keystore.properties
│ │ │ └── settings.gradle
│ │ ├── app.json
│ │ ├── index.js
│ │ ├── ios/
│ │ │ ├── GunDemo/
│ │ │ │ ├── AppDelegate.h
│ │ │ │ ├── AppDelegate.m
│ │ │ │ ├── Base.lproj/
│ │ │ │ │ └── LaunchScreen.xib
│ │ │ │ ├── Images.xcassets/
│ │ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Info.plist
│ │ │ │ └── main.m
│ │ │ ├── GunDemo-tvOS/
│ │ │ │ └── Info.plist
│ │ │ ├── GunDemo-tvOSTests/
│ │ │ │ └── Info.plist
│ │ │ ├── GunDemo.xcodeproj/
│ │ │ │ └── project.pbxproj
│ │ │ └── GunDemoTests/
│ │ │ ├── GunDemoTests.m
│ │ │ └── Info.plist
│ │ ├── package.json
│ │ ├── shim.js
│ │ └── src/
│ │ ├── App/
│ │ │ ├── Demo.js
│ │ │ ├── PolyFillCrypto.js
│ │ │ ├── app.js
│ │ │ └── index.js
│ │ ├── extensions/
│ │ │ ├── asyncStorageAdapter.js
│ │ │ └── sea.js
│ │ └── webview-crypto/
│ │ ├── MainWorker.d.ts
│ │ ├── MainWorker.js
│ │ ├── WebViewWorker.d.ts
│ │ ├── WebViewWorker.js
│ │ ├── asyncSerialize.d.ts
│ │ ├── asyncSerialize.js
│ │ ├── compat.d.ts
│ │ ├── compat.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── serializeBinary.d.ts
│ │ ├── serializeBinary.js
│ │ ├── webViewWorkerString.d.ts
│ │ └── webViewWorkerString.js
│ ├── relay-sqlite-example/
│ │ ├── README.md
│ │ ├── capacitor.config.ts
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.vue
│ │ │ ├── components/
│ │ │ │ └── RelayMode.vue
│ │ │ ├── composables/
│ │ │ │ ├── GunStorageAdapter.ts
│ │ │ │ ├── useNetwork.ts
│ │ │ │ ├── useNetworkStatus.ts
│ │ │ │ └── useToast.ts
│ │ │ ├── main.ts
│ │ │ ├── pages/
│ │ │ │ └── index.vue
│ │ │ ├── router/
│ │ │ │ └── index.ts
│ │ │ ├── services/
│ │ │ │ ├── dbVersionService.ts
│ │ │ │ ├── globalServices.ts
│ │ │ │ ├── initializeAppService.ts
│ │ │ │ ├── sqliteService.ts
│ │ │ │ └── storageService.ts
│ │ │ └── theme/
│ │ │ └── variables.css
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ ├── relay.service
│ ├── smoothie.js
│ ├── start.js.html
│ ├── stats.html
│ ├── style.css
│ ├── todo/
│ │ └── index.html
│ ├── vanilla/
│ │ ├── screen.html
│ │ ├── todo.html
│ │ ├── user.html
│ │ └── video.html
│ ├── vue/
│ │ ├── index.html
│ │ └── todo.html
│ ├── wave.html
│ ├── webpack/
│ │ ├── .gitignore
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── app.js
│ │ │ └── index.html
│ │ └── webpack.config.js
│ └── where/
│ └── index.html
├── gun.d.ts
├── gun.js
├── hooks/
│ ├── build
│ └── post_push
├── index.d.ts
├── index.js
├── kit/
│ ├── web.css
│ └── web.js
├── lib/
│ ├── afore.js
│ ├── aws.js
│ ├── axe.js
│ ├── book.js
│ ├── bye.js
│ ├── crashed.js
│ ├── cryptomodules.js
│ ├── debug.js
│ ├── dom.js
│ ├── email.js
│ ├── erase.js
│ ├── evict.js
│ ├── file.js
│ ├── forget.js
│ ├── fork.js
│ ├── fsrm.js
│ ├── fun.js
│ ├── hot.js
│ ├── http.js
│ ├── hub.js
│ ├── ipfs.js
│ ├── ison.js
│ ├── jsonp.js
│ ├── later.d.ts
│ ├── later.js
│ ├── les.js
│ ├── level.js
│ ├── lex.js
│ ├── list.js
│ ├── load.d.ts
│ ├── load.js
│ ├── match.js
│ ├── memdisk.js
│ ├── meta.js
│ ├── mix.js
│ ├── mobile.js
│ ├── monotype.js
│ ├── multicast.js
│ ├── nomem.js
│ ├── normalize.js
│ ├── not.d.ts
│ ├── not.js
│ ├── open.d.ts
│ ├── open.js
│ ├── path.d.ts
│ ├── path.js
│ ├── promise.d.ts
│ ├── promise.js
│ ├── radisk.d.ts
│ ├── radisk.js
│ ├── radisk2.js
│ ├── radix.d.ts
│ ├── radix.js
│ ├── radix2.js
│ ├── radmigtmp.js
│ ├── ras.js
│ ├── reboot.js
│ ├── rfs.js
│ ├── rfsmix.js
│ ├── rindexed.d.ts
│ ├── rindexed.js
│ ├── rls.js
│ ├── rmem.js
│ ├── role.js
│ ├── rs3.js
│ ├── serve.js
│ ├── server.js
│ ├── service.js
│ ├── shim.js
│ ├── space.js
│ ├── stats.js
│ ├── store.d.ts
│ ├── store.js
│ ├── super.js
│ ├── text-encoding/
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── index.js
│ │ ├── lib/
│ │ │ ├── encoding-indexes.js
│ │ │ └── encoding.js
│ │ └── package.json
│ ├── then.d.ts
│ ├── then.js
│ ├── time.js
│ ├── unbuild.js
│ ├── unset.d.ts
│ ├── unset.js
│ ├── untitled.js
│ ├── upload.js
│ ├── utils.js
│ ├── uws.js
│ ├── verify.js
│ ├── wave.js
│ ├── webrtc.d.ts
│ ├── webrtc.js
│ ├── wire.js
│ ├── ws.js
│ ├── wsp.js
│ ├── wsproto.js
│ └── yson.js
├── nts.js
├── package.json
├── rad.js
├── sea/
│ ├── aeskey.js
│ ├── array.js
│ ├── auth.js
│ ├── base64.js
│ ├── buffer.js
│ ├── certify.js
│ ├── create.js
│ ├── decrypt.js
│ ├── encrypt.js
│ ├── https.js
│ ├── index.js
│ ├── pair.js
│ ├── recall.js
│ ├── root.js
│ ├── sea.js
│ ├── secret.js
│ ├── settings.js
│ ├── sha1.js
│ ├── sha256.js
│ ├── share.js
│ ├── shim.js
│ ├── sign.js
│ ├── then.js
│ ├── user.js
│ ├── verify.js
│ └── work.js
├── sea.d.ts
├── sea.js
├── src/
│ ├── ask.js
│ ├── back.js
│ ├── book.js
│ ├── chain.js
│ ├── core.js
│ ├── dup.js
│ ├── get.js
│ ├── index.js
│ ├── localStorage.js
│ ├── map.js
│ ├── mesh.js
│ ├── on.js
│ ├── onto.js
│ ├── polyfill/
│ │ └── unbuild.js
│ ├── put.js
│ ├── root.js
│ ├── set.js
│ ├── shim.js
│ ├── state.js
│ ├── valid.js
│ └── websocket.js
├── test/
│ ├── abc.js
│ ├── bug/
│ │ ├── 121.js
│ │ ├── 1243.js
│ │ ├── 322.js
│ │ ├── 686.js
│ │ └── 783.js
│ ├── common.js
│ ├── debug/
│ │ └── deep-set.html
│ ├── download-log.html
│ ├── expect.js
│ ├── gun.html
│ ├── https/
│ │ ├── ca.crt
│ │ ├── ca.csr
│ │ ├── ca.key
│ │ ├── server.crt
│ │ ├── server.csr
│ │ ├── server.key
│ │ ├── server.key.passphrase
│ │ └── test.js
│ ├── hub/
│ │ ├── .hubignore
│ │ ├── hub-test.js
│ │ ├── index.html
│ │ └── whatever/
│ │ └── aws-key.txt
│ ├── index.js
│ ├── json2.js
│ ├── mocha.css
│ ├── mocha.html
│ ├── mocha.js
│ ├── normalize/
│ │ └── normalize.html
│ ├── old/
│ │ ├── all.js
│ │ ├── interface.js
│ │ ├── performance.js
│ │ ├── s3pricing.html
│ │ ├── server.js
│ │ ├── set.js
│ │ ├── shoot.html
│ │ ├── shoot.js
│ │ ├── shotgun.js
│ │ ├── timelines.txt
│ │ └── tmp.js
│ ├── panic/
│ │ ├── 1putackget.js
│ │ ├── 2getget.js
│ │ ├── 3puts.js
│ │ ├── 4putackdedup.js
│ │ ├── axe/
│ │ │ ├── 1no_self.js
│ │ │ ├── 2no_dup.js
│ │ │ ├── 3get_turns.js
│ │ │ ├── 4get_subs.js
│ │ │ ├── 5mob.js
│ │ │ ├── index.html
│ │ │ └── load_balance.js
│ │ ├── b2s2s2b.js
│ │ ├── bulkimport.js
│ │ ├── chat-user.js
│ │ ├── chat.js
│ │ ├── curl-server.js
│ │ ├── e2e/
│ │ │ ├── distributed.js
│ │ │ ├── holy/
│ │ │ │ ├── grail.js
│ │ │ │ ├── gun-server.js
│ │ │ │ ├── index.html
│ │ │ │ └── ports.json
│ │ │ └── package.json
│ │ ├── holy-grail.js
│ │ ├── index.html
│ │ ├── infinite-scroll/
│ │ │ ├── index.html
│ │ │ └── index.js
│ │ ├── large-nodes.js
│ │ ├── latency.js
│ │ ├── level.js
│ │ ├── lexical.js
│ │ ├── livestream.js
│ │ ├── load.js
│ │ ├── no-override.js
│ │ ├── on-recovery.js
│ │ ├── radisk.js
│ │ ├── radisk_split_failure.js
│ │ ├── s2s-all-delayed-peer-add.js
│ │ ├── s2s-all.js
│ │ ├── scale.js
│ │ ├── set.js
│ │ ├── shocknet.js
│ │ ├── speak.js
│ │ ├── thread.js
│ │ ├── user-paste.js
│ │ ├── users.js
│ │ ├── util/
│ │ │ ├── load-browser-scripts.js
│ │ │ └── open.js
│ │ └── who.js
│ ├── panic.html
│ ├── ptsd/
│ │ ├── benchmark.js
│ │ ├── memdisk.html
│ │ ├── memdisk.js
│ │ ├── memory.html
│ │ ├── perf.js
│ │ ├── ptsd.html
│ │ ├── ptsd.js
│ │ ├── radix.html
│ │ ├── radix.js
│ │ ├── spam.js
│ │ ├── stool.css
│ │ └── streampipe.js
│ ├── rad/
│ │ ├── 2020and2021.js
│ │ ├── bench.js
│ │ ├── book.html
│ │ ├── book.js
│ │ ├── browser.html
│ │ ├── crash.js
│ │ ├── mocha.html
│ │ ├── old2020json/
│ │ │ ├── !
│ │ │ └── %1C
│ │ ├── parse.rad
│ │ ├── rad.book.spec.js
│ │ ├── rad.js
│ │ └── recover.js
│ ├── radix.js
│ ├── sea/
│ │ ├── nodeauth.js
│ │ ├── sea-tmp.html
│ │ ├── sea.html
│ │ ├── sea.js
│ │ └── sea_old.js
│ ├── server/
│ │ ├── http.js
│ │ ├── node-client.js
│ │ └── node-write.js
│ ├── tmp/
│ │ ├── bigsync.js
│ │ ├── contact.html
│ │ ├── contacts.html
│ │ ├── indexedDB.html
│ │ ├── mitra/
│ │ │ ├── client_to_server.js
│ │ │ └── gun_https2.js
│ │ ├── radisk.html
│ │ ├── say.html
│ │ ├── seanode.js
│ │ ├── space.html
│ │ ├── time.html
│ │ └── tmp.html
│ ├── trace.html
│ ├── trace.js
│ └── wire.txt
├── tsconfig.json
└── types/
├── gun/
│ ├── GunCallbackGet.d.ts
│ ├── GunCallbackMap.d.ts
│ ├── GunCallbackOn.d.ts
│ ├── GunCallbackOnce.d.ts
│ ├── GunCallbackPut.d.ts
│ ├── GunDataNode.d.ts
│ ├── GunHookCallbackBye.d.ts
│ ├── GunHookCallbackCreate.d.ts
│ ├── GunHookCallbackGet.d.ts
│ ├── GunHookCallbackHi.d.ts
│ ├── GunHookCallbackIn.d.ts
│ ├── GunHookCallbackOpt.d.ts
│ ├── GunHookCallbackOut.d.ts
│ ├── GunHookCallbackPut.d.ts
│ ├── GunNodeGet.d.ts
│ ├── GunNodePut.d.ts
│ ├── GunOptions.d.ts
│ ├── GunOptionsOn.d.ts
│ ├── GunOptionsOnce.d.ts
│ ├── GunOptionsPut.d.ts
│ ├── GunPeer.d.ts
│ ├── GunSchema.d.ts
│ ├── GunSoul.d.ts
│ ├── GunValueSimple.d.ts
│ ├── IGun.d.ts
│ ├── IGunChain.d.ts
│ ├── IGunHookContext.d.ts
│ ├── IGunInstance.d.ts
│ ├── IGunInstanceHookHandler.d.ts
│ ├── IGunInstanceRoot.d.ts
│ ├── IGunMeta.d.ts
│ ├── IGunOnEvent.d.ts
│ ├── LEX.d.ts
│ ├── LEXQuery.d.ts
│ ├── _GunRoot.d.ts
│ ├── index.d.ts
│ └── pany.d.ts
├── index.d.ts
├── sea/
│ ├── GunCallbackUserAuth.d.ts
│ ├── GunCallbackUserCreate.d.ts
│ ├── GunHookCallbackAuth.d.ts
│ ├── GunUser.d.ts
│ ├── IGun.d.ts
│ ├── IGunInstance.d.ts
│ ├── IGunInstanceHookHandler.d.ts
│ ├── IGunInstanceRoot.d.ts
│ ├── IGunUserInstance.d.ts
│ ├── IPolicy.d.ts
│ ├── ISEA.d.ts
│ ├── ISEAPair.d.ts
│ ├── OptionsUserAuth.d.ts
│ ├── OptionsUserRecall.d.ts
│ ├── Policy.d.ts
│ └── index.d.ts
├── test/
│ ├── gun-back.test-d.ts
│ ├── gun-get.test-d.ts
│ ├── gun-instance.test-d.ts
│ ├── gun-map.test-d.ts
│ ├── gun-on.test-d.ts
│ ├── gun-once.test-d.ts
│ ├── gun-opt.test-d.ts
│ ├── gun-put.test-d.ts
│ ├── gun-set.test-d.ts
│ ├── gun-user-auth.test-d.ts
│ ├── gun-user-leave.test-d.ts
│ ├── gun-user-recall.test-d.ts
│ ├── gun-user.test-d.ts
│ ├── sea-certify.test-d.ts
│ └── sea.test-d.ts
└── utils.d.ts
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
node_modules
radata
stats.radata
.git
.gitignore
*.md
================================================
FILE: .github/FUNDING.yml
================================================
# These are supported funding model platforms
github: amark
patreon: gunDB
open_collective: gun
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
================================================
FILE: .github/workflows/ci.yml
================================================
name: ci
on:
push:
pull_request:
jobs:
test:
strategy:
matrix:
node-version: [14.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
# checkout the code
- name: Checkout
uses: actions/checkout@v4 # Updated to v4 (latest as of 2025)
# verify the version in package.json matches the release tag
- name: Version
uses: tcurdt/action-verify-version-npm@master # No version update as it's using @master
# setup the node version
- name: Setup Node ${{ matrix.node-version }}
uses: actions/setup-node@v4 # Updated to v4 (latest as of 2025)
with:
node-version: ${{ matrix.node-version }}
# cache node_modules if we can
- name: Cache
id: cache-modules
uses: actions/cache@v4 # Updated to v4 (latest as of 2025)
with:
path: node_modules
key: ${{ matrix.node-version }}-${{ runner.os }}-build-${{ hashFiles('package.json') }}
# otherwise run install
- name: Install
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
# run tests
- name: Test
run: npm test
# create github release
release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [test]
runs-on: ubuntu-latest
steps:
# create github release (which triggers the release workflows)
- name: Release
uses: softprops/action-gh-release@v2 # Updated to v2 (latest stable version as of 2025)
# env:
# GITHUB_TOKEN: ${{ secrets.PAT }}
# # publish latest master or release to dockerhub
# dockerhub:
# if: github.event_name == 'push'
# needs: [test]
# runs-on: ubuntu-latest
# env:
# image: ${{ secrets.DOCKERHUB_USERNAME }}/gun
# steps:
#
# - name: Checkout
# uses: actions/checkout@v4 # Updated to v4
#
# - name: Login
# env:
# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
# run: echo -n ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
#
# - name: Build
# run: |
# echo "SHA=$GITHUB_SHA"
# docker build --build-arg SHA=$GITHUB_SHA \
# BUILD_DATE=$(date +'%Y-%m-%dT%H:%M:%S') \
# VCS_REF=${GITHUB_REF} \
# VCS_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} \
# VERSION=${GITHUB_REF##*/} \
# SHA=$GITHUB_SHA \
# --label "SHA=$GITHUB_SHA" \
# --tag ${{ env.image }}:${GITHUB_REF##*/} \
# --tag ${{ env.image }}:latest \
# .
#
# - name: Push
# run: docker push ${{ env.image }}
# publish release to npm
npm:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4 # Updated to v4
- name: Publish
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm install
npm publish --access=public
================================================
FILE: .gitignore
================================================
node_modules
npm-debug.log
yarn.lock
*data.json
*data*
*.db
.idea/
*.bak
*.new
*.log
v8.json
*.DS_store
isolate*.log
.esm-cache
.sessionStorage
.localStorage
/types/**/*.ts
!/types/**/*.d.ts
!/types/**/*.test-d.ts
/gun.ts
/temp/
================================================
FILE: .npmignore
================================================
*.ts
/temp/
!*.d.ts
*.radata
isolate-*
================================================
FILE: .prettierignore
================================================
*
================================================
FILE: .travis.yml
================================================
language: node_js
branches:
except:
- debug
- manhattan
node_js:
- 10
cache:
directories:
- node_modules
================================================
FILE: CHANGELOG.md
================================================
# CHANGELOG
## 0.2020.x
`>0.2020.520` may break in-process `gun1` `gun2` message passing. Check `test/common.js` "Check multi instance message passing" for a hint and/or complain on community chat.
- No breaking changes to core API.
- Storage adapter `put` event breaking change (temporary?), RAD is official now and storage adapters should be RAD plugins instead of GUN adapters.
- GUN soul format changed from being a random UUID to being a more predictable graph path (of where initially created) to support even better offline behavior. This means `null`ing & replacing an object will not create a new but re-merge.
- Pretty much all internal GUN utility will be deleted, these are mostly undocumented but will affect some people - they will still be available as a separate file but deprecated.
- As the DHT gets implemented, your relay peers may automatically connect to it, so do not assume your peer is standalone. `Gun({axe: false` should help prevent this but loses you most scaling properties.
- The 2019 -> 2020 "changes" are happening gradually, based on experimental in-production tests.
- As always, **most important** is to ask in the [community chat](http://chat.gun.eco) if you have any issues, and to keep up to date with changes.
## 0.2019.x
Some RAD & SEA data format changes, but with as much backward compatibility as possible, tho ideally should be dropped.
## 0.9.x
No breaking changes, but the new Radix Storage Engine (RSE) has been finally integrated and works with S3 as a backup.
// Edit: commentary removed.
## 0.8.x
Adapter interfaces have changed from `Gun.on('event', cb)` to `gun.on('event', cb)`, this will force adapters to be instance specific.
`.path()` and `.not()` have been officially removed from the core bundle, you can bundle them yourself at `lib/path.js` and `lib/not.js` if you still need them.
## 0.7.x
Small breaking change to `.val(cb)`:
Previously `.val(cb)` would ONLY be called when data exists, like `.on(cb)`.
However, due to popular demand, people wanted `.val(cb)` to also get called for `.not(cb)` rather than (before) it would "wait" until data arrived.
NOTE: For dynamic paths, `.val(cb)` will still wait, like:
`gun.get('users').map().val(cb)` because the behavior of the `map()` is simply to not fire anything down the chain unless items are found.
## 0.6.x
Introduced experimental features, chaining `.val()` (no callback) and `.map(cb)` behaving as a map/reduce function.
It also upgraded the socket adapters and did end-to-end load testing and correctness testing.
## 0.5.9
GUN 0.3 -> 0.4 -> 0.5 Migration Guide:
`gun.back` -> `gun.back()`;
`gun.get(key, cb)` -> cb(err, data) -> cb(at) at.err, at.put;
`gun.map(cb)` -> `gun.map().on(cb)`;
`gun.init` -> deprecated;
`gun.put(data, cb)` -> cb(err, ok) -> cb(ack) ack.err, ack.ok;
`gun.get(key)` global/absolute -> `gun.back(-1).get(key)`;
`gun.key(key)` -> temporarily broken;
## 0.3.7
- Catch localStorage errors.
## 0.3.6
- Fixed S3 typo.
## 0.3.5
- Fixed server push.
## 0.3.4
- Breaking Change! `list.set(item)` returns the item's chain now, not the list chain.
- Client and Server GUN servers are now more up to spec, trimmed excess HTTP/REST header data.
- Gun.is.lex added.
## 0.3.3
- You can now link nodes natively, `gun.get('mark').path('owner').put(gun.get('cat'))`!
- Sets (or tables, collections, lists) are now easily done with `gun.get('users').set(gun.get('person/mark'))`.
## 0.3.2
Bug fixes.
## 0.3.1
Bug fixes.
## 0.3
Migration Guide! Migrate by changing `.attach(` to `.wsp(` on your server if you have one with gun. Remove `.set()` (delete it), and change `.set($DATA)` (where you call set with something) to `.path('I' + Date.now() + 'R' + Gun.text.random(5)).put($DATA)`. If you have NodeJS style callbacks in your `.get` (which documentation previously recommended that you shouldn't) they previous took `err, graph` and now they take `err, node` (which means now using callback style is fine to use). Inside of `.not()` no longer use `return` or `this`, instead (probably) use `gun` and no `return`. If you are a module developer, use `opt.wire` now instead of `opt.hooks` and message Mark since he needs to talk to you since the wire protocol has changed.
- Server side default `.wsp()` renamed from `.attach()`.
- `.set()` deprecated because it did a bunch of random inconsistent things. Its useful behavior has now become implicit (see below) or can be done explicitly.
- `.not()` it was previously common to `return` the chain inside of .not, beware that if you have code like `gun.get(key).not(function(){ return this.put({}).key(key) }).val()` cause `.val()` to be triggered twice (this is intentional, because it funnels two separate chains together) which previously didn't happen. To fix this, just don't return the chain.
- `.put()` and `.path()` do implicit `.init()` by default, turn on explicit behavior with `Gun({init: true})`.
- `.get(soul, cb)` cb is called back with `err, node` rather than `err, graph`.
- Options `opt.wire` renamed from `opt.hooks`.
- `.val()` when called empty automatically cleanly logs for convenience purposes.
- `.init()` added.
- `Gun.is.val` renamed from `Gun.is.value`.
- `Gun.is.rel` renamed from `Gun.is.soul`.
- `Gun.is.node.soul` renamed from `Gun.is.soul.on`.
- `Gun.union.ify` renamed from `Gun.union.pseudo`.
- `Gun.union.HAM` renamed from `Gun.HAM`.
- `Gun.HAM` is now the actual HAM function for conflict resolution.
- `Gun._.state` renamed from `Gun._.HAM`.
- Maximum Callstack Exceeded is less problematic now, unless you intentionally choke the thread. #95
- Putting a regex or Date or NaN is actually detected and causes an error now while before it was silent. #122 #123
- `.on()` gets called when a key is later newly made while before it did not. #116
- `.val()` should not ever get called with a relation alone (internals should resolve it), this is fixed. #132
================================================
FILE: Dockerfile
================================================
# install packages
FROM node:lts-alpine as builder
RUN mkdir /work
WORKDIR /work
RUN apk add --no-cache alpine-sdk python3
COPY package*.json ./
RUN mkdir -p node_modules
RUN npm ci --only=production
# fresh image without dev packages
FROM node:lts-alpine
# build-time metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
ARG VCS_URL
ARG VERSION
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="Gun - Offline First, Javascript Graph Database" \
org.label-schema.url="http://gun.js.org" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.vendor="The Gun Database Team" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"
ARG SHA
RUN mkdir /work
WORKDIR /work
COPY --from=builder /work/node_modules ./node_modules
RUN npm rebuild -q
ADD . .
RUN echo "{ \"sha\": \"$SHA\" }" > version.json
RUN cat version.json
EXPOSE 8080
EXPOSE 8765
CMD ["npm","start"]
================================================
FILE: LICENSE.md
================================================
Copyright (c) 2015 Mark Nadal
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
---
Copyright (c) 2015 Mark Nadal
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
---
Copyright 2015 Mark Nadal
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Procfile
================================================
web: node --inspect examples/http.js
================================================
FILE: README.md
================================================
<p id="readme"><a href="https://gun.eco/"><img width="40%" src="https://cldup.com/TEy9yGh45l.svg"/></a><img width="50%" align="right" vspace="25" src="https://gun.eco/see/demo.gif"/></p>
[](https://www.jsdelivr.com/package/npm/gun)

[](http://chat.gun.eco)
**GUN** is an [ecosystem](https://gun.eco/docs/Ecosystem) of **tools** that let you build [community run](https://www.nbcnews.com/tech/tech-news/these-technologists-think-internet-broken-so-they-re-building-another-n1030136) and [encrypted applications](https://gun.eco/docs/Cartoon-Cryptography) - like an Open Source Firebase or a Decentralized Dropbox.
The [Internet Archive](https://news.ycombinator.com/item?id=17685682) and [100s of other apps](https://github.com/amark/gun/wiki/awesome-gun) run GUN in-production.
+ Multiplayer by default with realtime p2p state synchronization!
+ Graph data lets you use key/value, tables, documents, videos, & more!
+ Local-first, offline, and decentralized with end-to-end encryption.
Decentralized alternatives to [Zoom](https://www.zdnet.com/article/era-hatches-meething-an-open-source-browser-based-video-conferencing-system/), [Reddit](https://notabug.io/t/whatever/comments/36588a16b9008da4e3f15663c2225e949eca4a15/gpu-bot-test), [Instagram](https://iris.to/), [Slack](https://iris.to/), [YouTube](https://d.tube/), [Stripe](https://twitter.com/marknadal/status/1422717427427647489), [Wikipedia](https://news.ycombinator.com/item?id=17685682), Facebook [Horizon](https://twitter.com/marknadal/status/1424476179189305347) and more have already pushed terabytes of daily P2P traffic on GUN. We are a [friendly community](http://chat.gun.eco/) creating a [free fun future for freedom](https://youtu.be/1HJdrBk3BlE):
<table>
<tr>
<a href="https://youtu.be/s_m16-w6bBI"><img width="31%" src="https://gun.eco/see/3dvr.gif" title="3D VR"/></a>
<a href="https://github.com/cstefanache/cstefanache.github.io/blob/06697003449e4fc531fd32ee068bab532976f47b/_posts/2016-08-02-gun-db-artificial-knowledge-sharing.md"><img width="31%" src="https://gun.eco/see/aiml.gif" title="AI/ML"/></a>
<a href="http://gps.gunDB.io/"><img width="31%" src="https://gun.eco/see/gps.gif" title="GPS"/></a>
</tr>
<tr>
<a href="https://github.com/lmangani/gun-scape#gun-scape"><img width="31%" src="https://gun.eco/see/dataviz.gif" title="Data Viz"/></a>
<a href="https://github.com/amark/gun/wiki/Auth"><img width="31%" src="https://gun.eco/see/p2p.gif" title="P2P"/></a>
<a href="https://github.com/Stefdv/gun-ui-lcd#okay-what-about-gundb-"><img width="31%" src="https://gun.eco/see/iot.gif" title="IoT"/></a>
</tr>
<tr>
<a href="http://chat.gun.eco"><img width="31%" src="https://gun.eco/see/vr-world.gif" title="VR World"/></a>
<a href="https://youtu.be/1ASrmQ-CwX4"><img width="31%" src="https://gun.eco/see/ar.gif" title="AR"/></a>
<a href="https://meething.space/"><img width="31%" src="https://gun.eco/see/video-conf.gif" title="Video Confernece"/></a>
</tr>
</table>
## Quickstart
GUN is *super easy* to get started with:
- Try the [interactive tutorial](https://gun.eco/docs/Todo-Dapp) in the browser (**5min** ~ average developer).
- Or `npm install gun` and run the examples with `cd node_modules/gun && npm start` (**5min** ~ average developer).
> **Note:** If you don't have [node](http://nodejs.org/) or [npm](https://www.npmjs.com/), read [this](https://github.com/amark/gun/blob/master/examples/install.sh) first.
> If the `npm` command line didn't work, you may need to `mkdir node_modules` first or use `sudo`.
- An online demo of the examples are available here: http://try.axe.eco/
- Or write a quick app: ([try now in a playground](https://jsbin.com/kadobamevo/edit?js,console))
```html
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script>
// import GUN from 'gun'; // in ESM
// GUN = require('gun'); // in NodeJS
// GUN = require('gun/gun'); // in React
gun = GUN();
gun.get('mark').put({
name: "Mark",
email: "mark@gun.eco",
});
gun.get('mark').on((data, key) => {
console.log("realtime updates:", data);
});
setInterval(() => { gun.get('mark').get('live').put(Math.random()) }, 9);
</script>
```
- Or try something **mind blowing**, like saving circular references to a table of documents! ([play](http://jsbin.com/wefozepume/edit?js,console))
```javascript
cat = {name: "Fluffy", species: "kitty"};
mark = {boss: cat};
cat.slave = mark;
// partial updates merge with existing data!
gun.get('mark').put(mark);
// access the data as if it is a document.
gun.get('mark').get('boss').get('name').once(function(data, key){
// `once` grabs the data once, no subscriptions.
console.log("Mark's boss is", data);
});
// traverse a graph of circular references!
gun.get('mark').get('boss').get('slave').once(function(data, key){
console.log("Mark is the cat's slave!", data);
});
// add both of them to a table!
gun.get('list').set(gun.get('mark').get('boss'));
gun.get('list').set(gun.get('mark'));
// grab each item once from the table, continuously:
gun.get('list').map().once(function(data, key){
console.log("Item:", data);
});
// live update the table!
gun.get('list').set({type: "cucumber", goal: "jumping cat"});
```
Want to keep building more? **Jump to [THE DOCUMENTATION](#documentation)!**
# About
First & foremost, GUN is **a community of the nicest and most helpful people** out there. So [I want to invite you](http://chat.gun.eco) to come tell us about what **you** are working on & wanting to build (new or old school alike! Just be nice as well.) and ask us your questions directly. :)
<p align="center"><a href="https://www.youtube.com/watch?v=oTQXzhm8w_8"><img width="250" src="https://img.youtube.com/vi/oTQXzhm8w_8/0.jpg"><br/>Watch the 100 second intro!</a></p>
The GUN ecosystem stack is a collection of independent and modular tools covering everything from [CRDT](https://crdt.tech/) [conflict resolution](https://gun.eco/distributed/matters.html), [cryptographic security](https://gun.eco/docs/Cartoon-Cryptography) & [encryption](https://gun.eco/docs/SEA), [radix storage serialization](https://gun.eco/docs/RAD), [mesh networking](https://gun.eco/docs/DAM) & [routing algorithms](https://gun.eco/docs/Routing), to distributed systems [correctness & load testing](https://github.com/gundb/panic-server), CPU scheduled [JSON parser](https://github.com/amark/gun/blob/master/lib/yson.js) to prevent UI lag, and more!
<div><img width="48%" src="https://gun.eco/see/stack.png"/>
<img width="48%" align="right" src="https://gun.eco/see/layers.png"/></div>
On that note, let's get some official shout outs covered first:
### Support
<p align="center">
Thanks to:
<table>
<tr>
<td vlign="center"><a href="https://mozilla.org/builders"><img height="100" src="https://user-images.githubusercontent.com/1423657/81992335-85346480-9643-11ea-8754-8275e98e06bc.png"></a></td>
<td vlign="center"><a href="http://unstoppabledomains.com/"><img src="https://gun.eco/img/unstoppable.png"></a></td>
<td vlign="center"><a href="https://mask.io/"><img src="https://dimensiondev.github.io/Mask-VI/assets/Logo/MB--Logo--CombH-Circle--Blue.svg" width="250"></a></td>
</tr>
<tr>
<td vlign="center"> <a href="https://www.ajar.org/"><img src="https://www.ajar.org/logo.png" height="120"></a></td>
<td vlign="center"><a href="https://wallie.io/"><img src="https://raw.githubusercontent.com/gundb/gun-site/master/img/wallie.png" width="250"></a></td>
<td vlign="center"> <a href="https://ghostdrive.com/"><img src="https://gun.eco/img/ghostdrive.png" height="120"></a></td>
</tr>
</table>
<a href="https://github.com/robertheessels">Robert Heessels</a>,
<a href="http://qxip.net/">Lorenzo Mangani</a>,
<a href="https://nlnet.nl/">NLnet Foundation</a>,
<a href="http://github.com/samliu">Sam Liu</a>,
<a href="http://github.com/ddombrow">Daniel Dombrowsky</a>,
<a href="http://github.com/vincentwoo">Vincent Woo</a>,
<a href="http://github.com/coolaj86">AJ ONeal</a>,
<a href="http://github.com/ottman">Bill Ottman</a>,
<a href="http://github.com/mikewlange">Mike Lange</a>,
<a href="http://github.com/ctrlplusb">Sean Matheson</a>,
<a href="http://github.com/alanmimms">Alan Mimms</a>,
<a href="https://github.com/dfreire">Dário Freire</a>,
<a href="http://github.com/velua">John Williamson</a>,
<a href="http://github.com/finwo">Robin Bron</a>,
<a href="http://github.com/ElieMakhoul">Elie Makhoul</a>,
<a href="http://github.com/mikestaub">Mike Staub</a>,
<a href="http://github.com/bmatusiak">Bradley Matusiak</a>,
<a href="https://github.com/sjuxax">Jeff Cook</a>,
<a href="https://github.com/nmauersberg">Nico</a>,
<a href="https://github.com/ajartille">Aaron Artille</a>,
<a href="https://github.com/timjrobinson">Tim Robinson</a>,
<a href="https://github.com/hibas123">Fabian Stamm</a>,
<a href="https://twitter.com/mikestaub">Mike Staub</a>,
<a href="https://hunterowens.com/">Hunter Owens</a>,
<a href="https://github.com/JacobMillner">Jacob Millner</a>,
<a href="https://github.com/b-lack">Gerrit Balindt</a>,
<a href="https://github.com/gabriellemon">Gabriel Lemon</a>,
<a href="https://github.com/murageyun">Murage Martin</a>,
<a href="https://github.com/octalmage">Jason Stallings</a>
</p>
- Join others in sponsoring code: https://www.patreon.com/gunDB !
- Ask questions: http://stackoverflow.com/questions/tagged/gun ?
- Found a bug? Report at: https://github.com/amark/gun/issues ;
- **Need help**? Chat with us: http://chat.gun.eco .
### History
[GUN](https://gun.eco) was created by [Mark Nadal](https://twitter.com/marknadal) in 2014 after he had spent 4 years trying to get his collaborative web app to scale up with traditional databases.
<img width="250px" src="https://gun.eco/see/problem.png" align="left" title="pain point" style="margin: 0 1em 1em 0"> After he realized [Master-Slave database architecture causes one big bottleneck](https://gun.eco/distributed/matters.html), he (as a complete newbie outsider) naively decided **to question the status quo** and shake things up with controversial, heretical, and contrarian experiments:
**The NoDB** - no master, no servers, no "single source of truth", not built with a real programming language or real hardware, no DevOps, no locking, not *just* SQL or NoSQL but both (**all** - graphs, documents, tables, key/value).
The goal was to build a P2P database that could survive living inside **any** browser, and could correctly sync data between **any** device after assuming **any** offline-first activity.
<img src="https://gun.eco/see/compare.png" title="comparison table">
Technically, **GUN is a graph synchronization protocol** with a *lightweight embedded engine*, capable of doing *[20M+ API ops/sec](https://gun.eco/docs/Performance)* in **just ~9KB gzipped size**.
## Documentation
<table>
<tr>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/API">API reference</a></h3></td>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/Todo-Dapp">Tutorials</a></h3></td>
<td style="border: 0;"><h3><a href="https://github.com/amark/gun/tree/master/examples">Examples</a></h3></td>
</tr>
<tr>
<td style="border: 0;"><h3><a href="https://github.com/brysgo/graphql-gun">GraphQL</a></h3></td>
<td style="border: 0;"><h3><a href="https://github.com/PenguinMan98/electrontest">Electron</a></h3></td>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/React-Native">React & Native</a></h3></td>
</tr>
<tr>
<td style="border: 0;"><h3><a href="https://github.com/sjones6/vue-gun">Vue</a></h3></td>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/Svelte">Svelte</a></h3></td>
<td style="border: 0;"><h3><a href="https://github.com/Stefdv/gun-ui-lcd#syncing">Webcomponents</a></h3></td>
</tr>
<tr>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/CAP-Theorem">CAP Theorem Tradeoffs</a></h3></td>
<td style="border: 0;"><h3><a href="https://gun.eco/distributed/matters.html">How Data Sync Works</a></h3></td>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/Porting-GUN">How GUN is Built</a></h3></td>
</tr>
<tr>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/Auth">Crypto Auth</a></h3></td>
<td style="border: 0;"><h3><a href="https://github.com/amark/gun/wiki/Awesome-GUN">Modules</a></h3></td>
<td style="border: 0;"><h3><a href="https://gun.eco/docs/Roadmap">Roadmap</a></h3></td>
</tr>
</table>
This would not be possible without **community contributors**, big shout out to:
**[ajmeyghani](https://github.com/ajmeyghani) ([Learn GUN Basics with Diagrams](https://medium.com/@ajmeyghani/gundb-a-graph-database-in-javascript-3860a08d873c))**; **[anywhichway](https://github.com/anywhichway) ([Block Storage](https://github.com/anywhichway/gun-block))**; **[beebase](https://github.com/beebase) ([Quasar](https://github.com/beebase/gun-vuex-quasar))**; **[BrockAtkinson](https://github.com/BrockAtkinson) ([brunch config](https://github.com/BrockAtkinson/brunch-gun))**; **[Brysgo](https://github.com/brysgo) ([GraphQL](https://github.com/brysgo/graphql-gun))**; **[d3x0r](https://github.com/d3x0r) ([SQLite](https://github.com/d3x0r/gun-db))**; **[forrestjt](https://github.com/forrestjt) ([file.js](https://github.com/amark/gun/blob/master/lib/file.js))**; **[hillct](https://github.com/hillct) (Docker)**; **[JosePedroDias](https://github.com/josepedrodias) ([graph visualizer](http://acor.sl.pt:9966))**; **[JuniperChicago](https://github.com/JuniperChicago) ([cycle.js bindings](https://github.com/JuniperChicago/cycle-gun))**; **[jveres](https://github.com/jveres) ([todoMVC](https://github.com/jveres/todomvc))**; **[kristianmandrup](https://github.com/kristianmandrup) ([edge](https://github.com/kristianmandrup/gun-edge))**; **[Lightnet](https://github.com/Lightnet)** ([Awesome Vue User Examples](https://glitch.com/edit/#!/jsvuegunui?path=README.md:1:0) & [User Kitchen Sink Playground](https://gdb-auth-vue-node.glitch.me/)); **[lmangani](https://github.com/lmangani) ([Cytoscape Visualizer](https://github.com/lmangani/gun-scape), [Cassandra](https://github.com/lmangani/gun-cassandra), [Fastify](https://github.com/lmangani/fastify-gundb), [LetsEncrypt](https://github.com/lmangani/polyGun-letsencrypt))**; **[mhelander](https://github.com/mhelander) ([SEA](https://github.com/amark/gun/blob/master/sea.js))**; [omarzion](https://github.com/omarzion) ([Sticky Note App](https://github.com/omarzion/stickies)); [PsychoLlama](https://github.com/PsychoLlama) ([LevelDB](https://github.com/PsychoLlama/gun-level)); **[RangerMauve](https://github.com/RangerMauve) ([schema](https://github.com/gundb/gun-schema))**; **[robertheessels](https://github.com/swifty) ([gun-p2p-auth](https://github.com/swifty/gun-p2p-auth))**; **[rogowski](https://github.com/rogowski) (AXE)**; [sbeleidy](https://github.com/sbeleidy); **[sbiaudet](https://github.com/sbiaudet) ([C# Port](https://github.com/sbiaudet/cs-gun))**; **[Sean Matheson](https://github.com/ctrlplusb) ([Observable/RxJS/Most.js bindings](https://github.com/ctrlplusb/gun-most))**; **[Shadyzpop](https://github.com/Shadyzpop) ([React Native example](https://github.com/amark/gun/tree/master/examples/react-native))**; **[sjones6](https://github.com/sjones6) ([Flint](https://github.com/sjones6/gun-flint))**; RIP **[Stefdv](https://github.com/stefdv) (Polymer/web components)**; **[zrrrzzt](https://github.com/zrrrzzt) ([JWT Auth](https://gist.github.com/zrrrzzt/6f88dc3cedee4ee18588236756d2cfce))**; **[xmonader](https://github.com/xmonader) ([Python Port](https://github.com/xmonader/pygundb))**;
I am missing many others, apologies, will be adding them soon! This list is infinitely old & way out of date, if you want to be listed in it please make a PR! :)
## Testing
You will need to `npm install -g mocha` first. Then in the gun root folder run `npm test`. Tests will trigger persistent writes to the DB, so subsequent runs of the test will fail. You must clear the DB before running the tests again. This can be done by running `rm -rf *data*` command in the project directory.
## Shims
> These are only needed for NodeJS & React Native, they shim the native Browser WebCrypto API.
If you want to use [SEA](https://gun.eco/docs/SEA) for `User` auth and security, you will need to install:
`npm install @peculiar/webcrypto --save`
Please see [our React Native docs](https://gun.eco/docs/React-Native) for installation instructions!
Then you can require [SEA](https://gun.eco/docs/SEA) without an error:
```javascript
GUN = require('gun/gun');
SEA = require('gun/sea');
```
## Deploy
> Note: The default examples that get auto-deployed on `npm start` CDN-ify all GUN files, modules, & storage.
> Note: Moving forward, AXE will start to automatically cluster your peer into a shared DHT. You may want to disable this to run an isolated network.
> Note: When deploying a web application using GUN on a cloud provider, you may have to set `CI=false` in your `.env`. This prevents GUN-specific warnings from being treated as errors when deploying your app. You may also resolve this by modifying your webpack config to not try to build the GUN dependencies.
To quickly spin up a GUN relay peer for your development team, utilize [Heroku](http://heroku.com), [Docker](http://docker.com), or any others listed below. Or some variant thereof [Dokku](http://dokku.viewdocs.io/dokku/), K8s, etc. ! Or use all of them so your relays are decentralized too!
### Linux
`SSH` into the home directory of a clean OS install with `sudo` ability. Set any environment variables you need (see below), then do:
```bash
curl -o- https://raw.githubusercontent.com/amark/gun/master/examples/install.sh | bash
```
> Read [install.sh](https://github.com/amark/gun/blob/master/examples/install.sh) first!
> If `curl` is not found, *copy&paste* the contents of install.sh into your ssh.
You can now safely `CTRL+A+D` to escape without stopping the peer. To stop everything `killall screen` or `killall node`.
Environment variables may need to be set like `export HTTPS_CERT=~/cert.pem HTTPS_KEY=~/key.pem PORT=443`. You can also look at a sample [nginx](https://gun.eco/docs/nginx) config. For production deployments, you probably will want to use something like `pm2` or better to keep the peer alive after machine reboots.
### [Dome](https://www.trydome.io/)
[Deploy GUN in one-click](https://app.trydome.io/signup?package=gun) with [Dome](https://trydome.io) and receive a free trial:
[](https://app.trydome.io/signup?package=gun)
### [Heroku](https://www.heroku.com/)
[](https://heroku.com/deploy?template=https://github.com/amark/gun)
> Heroku deletes your data every 15 minutes, one way to fix this is by adding [cheap storage](https://gun.eco/docs/Using-Amazon-S3-for-Storage).
Or:
```bash
git clone https://github.com/amark/gun.git
cd gun
heroku create
git push -f heroku HEAD:master
```
Then visit the URL in the output of the 'heroku create' step, in a browser. Make sure to set any environment config vars in the settings tab.
### [Zeet.co](https://www.zeet.co/)
[](https://deploy.zeet.co/?url=https://github.com/amark/gun)
Then visit the URL in the output of the 'now --npm' step, in your browser.
### [Docker](https://www.docker.com/)
> Warning: Docker image is community contributed and may be old with missing security updates, please check version numbers to compare.
[](https://hub.docker.com/r/gundb/gun/) [](https://microbadger.com/images/gundb/gun "Get your own image badge on microbadger.com") [](https://hub.docker.com/r/gundb/gun/) [](https://hub.docker.com/r/gundb/gun/)
Pull from the [Docker Hub](https://hub.docker.com/r/gundb/gun/) [](https://microbadger.com/images/gundb/gun). Or:
```bash
docker run -p 8765:8765 gundb/gun
```
Or build the [Docker](https://docs.docker.com/engine/installation/) image locally:
```bash
git clone https://github.com/amark/gun.git
cd gun
docker build -t myrepo/gundb:v1 .
docker run -p 8765:8765 myrepo/gundb:v1
```
Or, if you prefer your Docker image with metadata labels (Linux/Mac only):
```bash
npm run docker
docker run -p 8765:8765 username/gun:git
```
Then visit [http://localhost:8765](http://localhost:8765) in your browser.
## License
Designed with ♥ by Mark Nadal, the GUN team, and many amazing contributors.
Openly licensed under [Zlib / MIT / Apache 2.0](https://github.com/amark/gun/blob/master/LICENSE.md).
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Famark%2Fgun?ref=badge_large)
[YouTube](https://www.youtube.com/channel/UCQAtpf-zi9Pp4__2nToOM8g) . [Twitter](https://twitter.com/marknadal)
================================================
FILE: RELEASE.md
================================================
Every push or pull request will
- run the tests
Every push to master will
- run the tests
- publish the latest docker image to dockerhub
Creating a tag that starts with `v` will
- create a new github release
- publish the release to npm
- publish the release to dockerhub
Creating a release from the github web interface will
- publish the release to npm
- publish the release to dockerhub
Creating the release for version `0.2021.001` from the command line works as follows
git tag v0.2021.001
git push --tags
================================================
FILE: SECURITY.md
================================================
# Security Policy
## Introduction
Security is our top priority. We are committed to ensuring that our project is as secure as possible for everyone who uses it. This document outlines our security policy and procedures for dealing with security issues.
## Supported Versions
We provide security updates for the following versions of our project:
| Version | Supported |
| ------- | ------------------ |
| 0.2020.x| :white_check_mark: |
| < 0.2020| :x: |
## Reporting a Vulnerability
If you discover a vulnerability, we would like to know about it so we can take steps to address it as quickly as possible.
### Report Format
When reporting vulnerabilities, please include the following details:
- Description of the vulnerability
- Steps to reproduce the issue
- Potential impact if left unaddressed
- Suggested mitigation or resolution if any
### Response Time
We aim to confirm the receipt of your vulnerability report within 48 hours. Depending on the severity and complexity of the issue, we strive to investigate the issue and provide an initial response within a week.
### Disclosure Policy
If the vulnerability is confirmed, we will work on a fix and plan a release. We ask that you do not publicly disclose the issue until it has been addressed by us.
## Security Practices
We follow industry-standard security practices, including regular audits of the services and features we provide, to maintain the trust of our users.
## Security Updates
We will communicate any security updates through our standard communication channels, including our project's release notes and official website.
## Conclusion
We greatly value the work of security researchers and believe that responsible disclosure of vulnerabilities is a valuable contribution to the security of the Internet. We encourage users to contribute to the security of our project by reporting any security-related issues to us.
================================================
FILE: app.json
================================================
{
"name": "gun-server",
"website": "http://gun.eco/",
"repository": "https://github.com/amark/gun",
"logo": "https://avatars3.githubusercontent.com/u/8811914",
"keywords": ["node", "gun", "gunDB", "database","graph","offline-first"],
"description": "Javascript, Offline-First Javascript Graph Database Server Peer",
"env": {
"NPM_CONFIG_PRODUCTION": {
"description": "If you do not want default features, set to \"true\".",
"value": "false"
},
"PEERS": {
"description": "Comma-separated list of peer urls to connect to",
"required": false
}
}
}
================================================
FILE: as.js
================================================
;(function(){
function as(el, gun, cb, opt){
el = $(el);
if(gun === as.gui && as.el && as.el.is(el)){ return }
opt = opt || {};
opt.match = opt.match || '{{ ';
opt.end = opt.end || ' }}';
;(function(){ // experimental
function nest(t, s,e, r, i,tmp,u){
if(r && !r.length){ return t||'' }
if(!t){ return [] }
e = e || s;
i = t.indexOf(s, i||0);
if(0 > i){ return [] }
tmp = t.indexOf(e, i+1);
if(!r){ return [t.slice(i+s.length, tmp)].concat(nest(t, s,e, r, tmp,tmp,u)) }
return t.slice(0,i)+r[0]+nest(t.slice(tmp+e.length), s,e, r.slice(1), 0,tmp,u);
}
/* experimental */
function template(tag, attr){
var html = (tag = $(tag))[0].outerHTML, sub, tmp;
if(html && (0 > html.indexOf(opt.match))){ return }
if(!attr){
$.each(tag[0].attributes, function(i,v){
if(!v){ return }
if(!nest(v.value, opt.match, opt.end).length){ return }
template(tag, v.name)
});
if((sub = tag.children()).length){
return sub.each(function(){ template(this) });
}
}
var data = [], plate = attr? tag.attr(attr) : tag.html();
tmp = nest(plate, opt.match, opt.end);
if(!tmp.length){ return }
$.each(tmp, function(pos, match){
var expr = match.split(' ');
var path = (expr[0]).split('.');
if(expr = expr.slice(1).join(' ')){
expr = new Function("_", "b", "return (_)" + expr);
}
var val = (expr && expr('')) || '';
data.push(val);
if(!attr){ tag.text(val) }
var ref = gun, sup = [], tmp;
if(tmp = tag.attr('name')){ sup.push(tmp) }
tag.parents("[name]").each(function(){
sup.push($(this).attr('name'));
});
$.each(path = sup.reverse().concat(path), function(i,v){
ref = ref.get(v);
});
ref.on(function(v){
v = data[pos] = expr? expr(v) : v;
var tmp = nest(plate, opt.match, opt.end, data);
if(attr){
tag.attr(attr, tmp);
} else {
tag.text(tmp);
}
});
});
}
template(el);
}());
as.gui = gun;
as.el = el;
if(el.data('as')){
el.html(el.data('as').fresh);
} else {
el.data('as', {
fresh: el.html()
})
}
el.find("[name]").each(function(){
if($(this).find("[name]").length){ return }
var name = $(this),
parents = name.parents("[name]"),
path = [],
ref = gun;
path.push(name.attr('name'));
parents.each(function(){
path.push($(this).attr('name'));
});
path = path.reverse();
path.forEach(function(key){
if('#' === key){
ref = ref.map()
} else {
ref = ref.get(key);
}
});
var many = path.slice().reverse().indexOf('#'), model;
many = (0 < ++many)? many : false;
if(many){
model = name.closest("[name='#']");
model = model.data('model') || model.data('model', {$: model.clone(), on: model.parent(), has: {}}).hide().data('model');
}
ref.get(function(at){
var data = at.put, key = at.get, gui = at.gun || at.$, ui = name, back;
if(model){
ui = model.has[(gui._).id];
if(!ui){
back = gui.back(many - 1);
ui = model.has[(back._).id];
if(!ui){
if(!(back._).get){ return }
ui = (model.has[(back._).id] = model.$.clone(true).prependTo(model.on));
}
ui = ui.find("[name='"+key+"']").first();
model.has[(gui._).id] = ui;
}
}
ui.data('gun', gui);
if(ui.data('was') === data){ return }
if(many && ui.is('.sort')){
var up = ui.closest("[name='#']");
var tmp = as.sort(data, up.parent().children().last());
tmp? up.insertAfter(tmp) : up.prependTo(up.parent());
}
if(as.lock === gui){ return }
if(!(data && data instanceof Object)){
(ui[0] && u === ui[0].value)? ui.text(data) : ui.val(data);
}
ui.data('was', data);
if(cb){
cb(data, key, ui);
}
});
});
}
as.wait = function(cb, wait, to){
return function(a,b,c){
var me = as.typing = this;
clearTimeout(to);
to = setTimeout(function(){
cb.call(me, a,b,c);
as.typing = me = false;
}, wait || 200);
}
}
as.sort = function sort(num, li){ return parseFloat(num) >= parseFloat($(li).find('.sort').text() || -Infinity)? li : sort(num, li.prev()) }
$(document).on('keyup', 'input, textarea, [contenteditable]', as.wait(function(){
var el = $(this);
var data = (el[0] && u === el[0].value)? el.text() : el.val();
var g = el.data('gun');
if(!g){ return }
as.lock = g;
g.put(data);
}, 99));
//$(document).on('submit', 'form', function(e){ e.preventDefault() });
var u;
window.as = as;
$.as = as;
}());
;(function(){
$(document).on('click', 'a, button', function(e){
var tmp = $(this).attr('href') || '';
if(0 === tmp.indexOf('http')){ return }
e.preventDefault();
r(tmp);
});
function r(href){
if(!href){ return }
if(href[0] == '#'){ href = href.slice(1) }
var h = href.split('/')[0];
$('.page').hide();
$('#' + h).show();
if(r.on === h){ return }
location.hash = href;
(r.page[h] || {on:function(){}}).on();
r.on = h;
return r;
};
r.page = function(h, cb){
r.page[h] = r.page[h] || {on: cb};
return r;
}
r.render = function(id, model, onto, data){
var $data = $(
$('#' + id).get(0) ||
$('.model').find(model).clone(true).attr('id', id).appendTo(onto)
);
$.each(data, function(field, val){
if($.isPlainObject(val)){ return }
$data.find("[name='" + field + "']").val(val).text(val);
});
return $data;
}
window.onhashchange = function(){ r(location.hash.slice(1)) };
$.as && ($.as.route = r);
if(window.as){
as.route = r;
} else {
$.route = r;
}
}());
;$(function(){
$('.page').not(':first').hide();
$.as.route(location.hash.slice(1));
$(JOY.start = JOY.start || function(){ $.as(document, gun, null, JOY.opt) });
if($('body').attr('peers')){ (console.warn || console.log)('Warning: Please upgrade <body peers=""> to https://github.com/eraeco/joydb#peers !') }
});
;(function(){ // need to isolate into separate module!
var joy = window.JOY = function(){};
joy.auth = function(a,b,cb,o){
if(!o){ o = cb ; cb = 0 }
if(o === true){
gun.user().create(a, b);
return;
}
gun.user().auth(a,b, cb,o);
}
var opt = joy.opt = window.CONFIG || {}, peers;
$('link[type=peer]').each(function(){ (peers || (peers = [])).push($(this).attr('href')) });
!window.gun && (opt.peers = opt.peers || peers || (function(){
(console.warn || console.log)('Warning: No peer provided, defaulting to DEMO peer. Do not run in production, or your data will be regularly wiped, reset, or deleted. For more info, check https://github.com/eraeco/joydb#peers !');
return ['https://gunjs.herokuapp.com/gun'];
}()));
window.gun = window.gun || Gun(opt);
gun.on('auth', function(ack){
console.log("Your namespace is publicly available at", ack.soul);
});
}());
================================================
FILE: axe.js
================================================
;(function(){
var sT = setTimeout || {}, u;
if(typeof window !== ''+u){ sT.window = window }
var AXE = (sT.window||'').AXE || function(){};
if(AXE.window = sT.window){ AXE.window.AXE = AXE }
var Gun = (AXE.window||'').GUN || require('./gun');
(Gun.AXE = AXE).GUN = AXE.Gun = Gun;
//if(!Gun.window){ try{ require('./lib/axe') }catch(e){} }
if(!Gun.window){ require('./lib/axe') }
Gun.on('opt', function(at){ start(at) ; this.to.next(at) }); // make sure to call the "next" middleware adapter.
function start(root){
if(root.axe){ return }
var opt = root.opt, peers = opt.peers;
if(false === opt.axe){ return }
if(!Gun.window){ return } // handled by ^ lib/axe.js
var w = Gun.window, lS = w.localStorage || opt.localStorage || {}, loc = w.location || opt.location || {}, nav = w.navigator || opt.navigator || {};
var axe = root.axe = {}, tmp, id;
var mesh = opt.mesh = opt.mesh || Gun.Mesh(root); // DAM!
tmp = peers[id = loc.origin + '/gun'] = peers[id] || {};
tmp.id = tmp.url = id; tmp.retry = tmp.retry || 0;
tmp = peers[id = 'http://localhost:8765/gun'] = peers[id] || {};
tmp.id = tmp.url = id; tmp.retry = tmp.retry || 0;
Gun.log.once("AXE", "AXE enabled: Trying to find network via (1) local peer (2) last used peers (3) a URL parameter, and last (4) hard coded peers.");
Gun.log.once("AXEWarn", "Warning: AXE is in alpha, use only for testing!");
var last = lS.peers || ''; if(last){ last += ' ' }
last += ((loc.search||'').split('peers=')[1]||'').split('&')[0];
root.on('bye', function(peer){
this.to.next(peer);
if(!peer.url){ return } // ignore WebRTC disconnects for now.
if(!nav.onLine){ peer.retry = 1 }
if(peer.retry){ return }
if(axe.fall){ delete axe.fall[peer.url || peer.id] }
(function next(){
if(!axe.fall){ setTimeout(next, 9); return } // not found yet
var fall = Object.keys(axe.fall||''), one = fall[(Math.random()*fall.length) >> 0];
if(!fall.length){ lS.peers = ''; one = 'https://gunjs.herokuapp.com/gun' } // out of peers
if(peers[one]){ next(); return } // already choose
mesh.hi(one);
}());
});
root.on('hi', function(peer){ // TEMPORARY! Try to connect all peers.
this.to.next(peer);
if(!peer.url){ return } // ignore WebRTC disconnects for now.
return; // DO NOT COMMIT THIS FEATURE YET! KEEP TESTING NETWORK PERFORMANCE FIRST!
(function next(){
if(!peer.wire){ return }
if(!axe.fall){ setTimeout(next, 9); return } // not found yet
var one = (next.fall = next.fall || Object.keys(axe.fall||'')).pop();
if(!one){ return }
setTimeout(next, 99);
mesh.say({dam: 'opt', opt: {peers: one}}, peer);
}());
});
function found(text){
axe.fall = {};
((text||'').match(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/ig)||[]).forEach(function(url){
axe.fall[url] = {url: url, id: url, retry: 0}; // RETRY
});
return;
// TODO: Finish porting below? Maybe not.
Object.keys(last.peers||'').forEach(function(key){
tmp = peers[id = key] = peers[id] || {};
tmp.id = tmp.url = id;
});
tmp = peers[id = 'https://guntest.herokuapp.com/gun'] = peers[id] || {};
tmp.id = tmp.url = id;
var mesh = opt.mesh = opt.mesh || Gun.Mesh(root); // DAM!
mesh.way = function(msg){
if(root.$ === msg.$ || (msg._||'').via){
mesh.say(msg, opt.peers);
return;
}
var at = (msg.$||'')._;
if(!at){ mesh.say(msg, opt.peers); return }
if(msg.get){
if(at.axe){ return } // don't ask for it again!
at.axe = {};
}
mesh.say(msg, opt.peers);
}
}
if(last){ found(last); return }
try{ fetch(((loc.search||'').split('axe=')[1]||'').split('&')[0] || loc.axe || 'https://raw.githubusercontent.com/wiki/amark/gun/volunteer.dht.md').then(function(res){
return res.text()
}).then(function(text){
found(lS.peers = text);
}).catch(function(){
found(); // nothing
})}catch(e){found()}
}
var empty = {}, yes = true;
try{ if(typeof module != ''+u){ module.exports = AXE } }catch(e){}
}());
================================================
FILE: bower.json
================================================
{
"name": "gun",
"main": "gun.js",
"version": "0.1.5",
"homepage": "http://gunDB.io",
"authors": [
{ "name": "Mark Nadal", "email": "mark@accelsor.com" },
{ "name": "Alex LaFroscia", "email": "alex@lafroscia.com" }
],
"repository": {
"type": "git",
"url": "https://github.com/amark/gun"
},
"description": "A distributed, embedded, graph database engine.",
"moduleType": [
"globals"
],
"keywords": [
"graph",
"database",
"gun",
"gundb",
"nodb"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
================================================
FILE: browser.js
================================================
// if(!(typeof navigator == "undefined") && navigator.product == "ReactNative"){
// require("./lib/mobile.js");
// }
module.exports = require('./gun.js');
================================================
FILE: examples/.gitignore
================================================
node_modules/*
npm-debug.log
*data.json
================================================
FILE: examples/Main.js
================================================
import { render } from './iris/js/lib/preact.js';
import { Router, route } from './iris/js/lib/preact-router.es.js';
import { createHashHistory } from './iris/js/lib/history.production.min.js';
import { Component } from './iris/js/lib/preact.js';
import { Link } from './iris/js/lib/preact.match.js';
import Helpers from './iris/js/Helpers.js';
import { html } from './iris/js/Helpers.js';
import QRScanner from './iris/js/QRScanner.js';
import PeerManager from './iris/js/PeerManager.js';
import Session from './iris/js/Session.js';
import { translate as t } from './iris/js/Translation.js';
import Settings from './iris/js/views/Settings.js';
import LogoutConfirmation from './iris/js/views/LogoutConfirmation.js';
import Chat from './iris/js/views/Chat.js';
import Store from './iris/js/views/Store.js';
import Checkout from './iris/js/views/Checkout.js';
import Product from './iris/js/views/Product.js';
import Login from './iris/js/views/Login.js';
import Profile from './iris/js/views/Profile.js';
import Group from './iris/js/views/Group.js';
import Message from './iris/js/views/Message.js';
import Follows from './iris/js/views/Follows.js';
import Feed from './iris/js/views/Feed.js';
import About from './iris/js/views/About.js';
import Explorer from './iris/js/views/Explorer.js';
import Contacts from './iris/js/views/Contacts.js';
import Torrent from './iris/js/views/Torrent.js';
import VideoCall from './iris/js/components/VideoCall.js';
import Identicon from './iris/js/components/Identicon.js';
import MediaPlayer from './iris/js/components/MediaPlayer.js';
import Footer from './iris/js/components/Footer.js';
import State from './iris/js/State.js';
import Icons from './iris/js/Icons.js';
const userAgent = navigator.userAgent.toLowerCase();
const isElectron = (userAgent.indexOf(' electron/') > -1);
if (!isElectron && ('serviceWorker' in navigator)) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('iris/serviceworker.js')
.catch(function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
State.init();
Session.init({autologin: true});
PeerManager.init();
Helpers.checkColorScheme();
const APPLICATIONS = [ // TODO: move editable shortcuts to State.local gun
{url: '/', text: t('home'), icon: Icons.home},
{url: '/feed', text: t('feed'), icon: Icons.feed},
{url: '/media', text: t('media'), icon: Icons.play},
{url: '/settings', text: t('settings'), icon: Icons.settings},
{url: '/store', text: t('store'), icon: Icons.store},
{url: '/explorer', text: t('explorer'), icon: Icons.folder},
{url: '/chat', text: t('messages'), icon: Icons.chat},
// {url: '/store', text: t('store'), icon: Icons.store}, // restore when it works!
{},
{url: '../stats.html', text: 'Gun node stats'},
{url: '../iris/index.html', text: 'Iris', icon: html`<img src="iris/img/icon128.png" width=24/>`},
{url: '../infinite-scroll/index.html', text: 'Infinite scroll'},
{url: '../chat/index.html', text: 'Chat'},
{url: '../game/space.html', text: 'Space'},
{},
{url: 'https://gun.eco/docs/', text: 'Gun documentation'},
{url: 'https://examples.iris.to/components/', text: 'Iris web components'}
];
const HomeView = () => {
return html`
<div class="main-view">
<div class="centered-container public-messages-view">
<h1>Hello, world!</h1>
<p>Here you can find sample applications and utilities for <a href="https://github.com/amark/gun">GUN</a>.</p>
<p>If you need any help, please feel free to join the GUN community chat: <a href="http://chat.gun.eco">http://chat.gun.eco</a></p>
<a href="/explorer" class="msg"><div class="msg-content">
<b>Explorer</b>
<p>Explore the data saved on the GUN database. Open to the side while using an application and see the data change in real-time.</p>
</div></a>
<a class="msg" href="game/space.html"><div class="msg-content">
<div class="img-container"><img src="iris/img/space-game.jpg"/></div>
<b>Space</b>
<p>Spaceflight game. Open in 2 or more browser windows.</p>
</div></a>
<a class="msg" href="/iris/index.html"><div class="msg-content">
<div class="img-container"><img src="iris/img/screenshot.png"/></div>
<b>Iris</b>
<p>Decentralized Twitter/Instagram. Provides modular components that can be reused in other applications (including this one).</p>
</div></a>
<a native class="msg" href="/chat/index.html"><div class="msg-content">
<div class="img-container"><img src="iris/img/gun-chat.jpg"/></div>
<b>Chat</b>
<p>Shoutbox!</p>
</div></a>
</div>
</div>
`;
};
class MenuView extends Component {
componentDidMount() {
State.local.get('showMenu').on(showMenu => this.setState({showMenu}));
}
render() {
const pub = Session.getPubKey();
return html`
<div class="application-list ${this.state.showMenu ? 'menu-visible-xs' : ''}">
<a href="/profile/${pub}">
<span class="icon"><${Identicon} str=${pub} width=40/></span>
<span class="text" style="font-size: 1.2em;border:0;margin-left: 7px;"><iris-text user="${pub}" path="profile/name" editable="false"/></span>
</a>
<br/><br/>
${APPLICATIONS.map(a => {
if (a.url) {
return html`
<a href=${a.url}>
<span class="icon">${a.icon || Icons.circle}</span>
<span class="text">${a.text}</span>
</a>`;
} else {
return html`<br/><br/>`;
}
})}
</div>
`;
}
};
class Main extends Component {
constructor() {
super();
this.showMenu = false;
}
componentDidMount() {
State.local.get('loggedIn').on(loggedIn => this.setState({loggedIn}));
}
handleRoute(e) {
let activeRoute = e.url;
if (!activeRoute && window.location.hash) {
return route(window.location.hash.replace('#', '')); // bubblegum fix back navigation
}
document.title = 'Iris';
if (activeRoute && activeRoute.length > 1) { document.title += ' - ' + Helpers.capitalize(activeRoute.replace('/', '')); }
State.local.get('activeRoute').put(activeRoute);
QRScanner.cleanupScanner();
}
onClickOverlay() {
if (this.state.showMenu) {
this.setState({showMenu: false});
}
}
toggleMenu(show) {
this.setState({showMenu: typeof show === 'undefined' ? !this.state.showMenu : show});
}
render() {
const content = this.state.loggedIn ? html`
<div class="visible-xs-flex" style="border-bottom:var(--sidebar-border-right)">
<svg onClick=${() => State.local.get('showMenu').put(this.showMenu = !this.showMenu)} style="padding: 5px;cursor:pointer;" viewBox="0 -53 384 384" width="40px"><path d="m368 154.667969h-352c-8.832031 0-16-7.167969-16-16s7.167969-16 16-16h352c8.832031 0 16 7.167969 16 16s-7.167969 16-16 16zm0 0"/><path d="m368 32h-352c-8.832031 0-16-7.167969-16-16s7.167969-16 16-16h352c8.832031 0 16 7.167969 16 16s-7.167969 16-16 16zm0 0"/><path d="m368 277.332031h-352c-8.832031 0-16-7.167969-16-16s7.167969-16 16-16h352c8.832031 0 16 7.167969 16 16s-7.167969 16-16 16zm0 0"/></svg>
</div>
<section class="main" style="flex-direction: row;">
<${MenuView}/>
<div style="flex: 3; display: flex">
<${Router} history=${createHashHistory()} onChange=${e => this.handleRoute(e)}>
<${HomeView} path="/"/>
<${Feed} path="/feed"/>
<${Feed} path="/search/:term?/:type?"/>
<${Feed} path="/media" index="media"/>
<${Login} path="/login"/>
<${Chat} path="/chat/:id?"/>
<${Message} path="/post/:hash"/>
<${Torrent} path="/torrent/:id"/>
<${About} path="/about"/>
<${Settings} path="/settings"/>
<${LogoutConfirmation} path="/logout"/>
<${Profile} path="/profile/:id?" tab="profile"/>
<${Profile} path="/replies/:id?" tab="replies"/>
<${Profile} path="/likes/:id?" tab="likes"/>
<${Profile} path="/media/:id" tab="media"/>
<${Group} path="/group/:id?"/>
<${Store} path="/store/:store?"/>
<${Checkout} path="/checkout/:store?"/>
<${Product} path="/product/:product/:store"/>
<${Product} path="/product/new" store=Session.getPubKey()/>
<${Explorer} path="/explorer/:node"/>
<${Explorer} path="/explorer"/>
<${Follows} path="/follows/:id"/>
<${Follows} followers=${true} path="/followers/:id"/>
<${Contacts} path="/contacts"/>
</${Router}>
</div>
</section>
<${VideoCall}/>
` : '';
return html`
<div id="main-content">
${content}
</div>
`;
}
}
render(html`<${Main}/>`, document.body);
$('body').css('opacity', 1); // use opacity because setting focus on display: none elements fails
================================================
FILE: examples/angular/.angular-cli.json
================================================
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "angular"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
================================================
FILE: examples/angular/.editorconfig
================================================
# Editor configuration, see http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false
================================================
FILE: examples/angular/.gitignore
================================================
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# dependencies
/node_modules
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings
# e2e
/e2e/*.js
/e2e/*.map
# System Files
.DS_Store
Thumbs.db
================================================
FILE: examples/angular/README.md
================================================
# Angular
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.
## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build.
## Running unit tests
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
================================================
FILE: examples/angular/e2e/app.e2e-spec.ts
================================================
import { AngularPage } from './app.po';
describe('angular App', () => {
let page: AngularPage;
beforeEach(() => {
page = new AngularPage();
});
it('should display message saying app works', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('app works!');
});
});
================================================
FILE: examples/angular/e2e/app.po.ts
================================================
import { browser, element, by } from 'protractor';
export class AngularPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
================================================
FILE: examples/angular/e2e/tsconfig.e2e.json
================================================
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es5",
"types":[
"jasmine",
"node"
]
}
}
================================================
FILE: examples/angular/example_package.json
================================================
{
"name": "angular",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^4.1.0",
"@angular/compiler": "^4.1.0",
"@angular/core": "^4.1.0",
"@angular/forms": "^4.1.0",
"@angular/http": "^4.1.0",
"@angular/platform-browser": "^4.1.0",
"@angular/platform-browser-dynamic": "^4.1.0",
"@angular/router": "^4.1.0",
"core-js": "^2.4.1",
"express-http-proxy": "^1.0.1",
"gun": "https://github.com/amark/gun.git#master",
"ngx-pipes": "^2.0.5",
"rxjs": "^5.3.0",
"underscore": "^1.8.3",
"zone.js": "^0.8.9"
},
"devDependencies": {
"@angular/cli": "1.0.0",
"@angular/compiler-cli": "^4.1.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"@types/underscore": "^1.8.0",
"codelyzer": "^2.1.1",
"jasmine-core": "^2.6.1",
"jasmine-spec-reporter": "^4.0.0",
"karma": "^1.6.0",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.0",
"ts-node": "^3.0.2",
"tslint": "~4.5.0",
"typescript": "^2.3.2"
}
}
================================================
FILE: examples/angular/karma.conf.js
================================================
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma')
],
client:{
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
files: [
{ pattern: './src/test.ts', watched: false }
],
preprocessors: {
'./src/test.ts': ['@angular/cli']
},
mime: {
'text/x-typescript': ['ts','tsx']
},
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true
},
angularCli: {
environment: 'dev'
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
================================================
FILE: examples/angular/protractor.conf.js
================================================
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./e2e/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
beforeLaunch: function() {
require('ts-node').register({
project: 'e2e/tsconfig.e2e.json'
});
},
onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
================================================
FILE: examples/angular/server.js
================================================
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765;
var host = process.env.OPENSHIFT_NODEJS_HOST || process.env.VCAP_APP_HOST || process.env.HOST || 'localhost';
var express = require('express');
var proxy = require('express-http-proxy');
var http = require('http');
var app = express();
var server = http.createServer(app);
var Gun = require('gun');
var gun = Gun({
file: 'data.json',
web: server
});
app.use(Gun.serve);
app.use(proxy(host + ':4200'));
server.listen(port);
console.log('Server started on port ' + port + ' with /gun');
================================================
FILE: examples/angular/src/app/app.component.css
================================================
html, body { font-size: 14pt; padding: 10px 2.5%;}
.hide { display: none; }
form .who { width: 10%; }
form .what { width: 80%; }
ul { list-style: none; padding: 0; }
ul .when {color: #555; font-size: 12pt; float: right; display: none; }
li:hover .when {display: inline;}
================================================
FILE: examples/angular/src/app/app.component.html
================================================
<div>
<form (ngSubmit)="add()">
<input type="text" [(ngModel)]="newTodo" name="newTodo" placeholder="New TODO">
<button type="submit" *ngIf="newTodo" [disabled]="newTodo?.trim().length === 0">Add</button>
</form>
<br />
<ul>
<li *ngFor="let todo of todos$ | async | pairs" (click)="delete(todo[0])">{{todo[1]}}</li>
</ul>
<button (click)="sub()" *ngIf="!todosSub">Log in console</button>
<button (click)="unsub()" *ngIf="!!todosSub">Stop logging</button>
</div>
================================================
FILE: examples/angular/src/app/app.component.spec.ts
================================================
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
}));
it('should create the app', async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
it(`should have as title 'app works!'`, async(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app.title).toEqual('app works!');
}));
it('should render title in a h1 tag', async(() => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain('app works!');
}));
});
================================================
FILE: examples/angular/src/app/app.component.ts
================================================
import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Subscription } from 'rxjs/Subscription';
import Gun from 'gun/gun';
import { GunDb } from 'app/gun.service';
import { on$ } from 'app/gun.helper';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
newTodo = '';
todos = this.db.gun.get('todos');
todos$: Observable<string[]> = on$(this.todos);
todosSub: Subscription;
constructor(private db: GunDb) { }
ngOnInit() { }
add() {
if (this.newTodo) {
this.todos.get(Gun.text.random()).put(this.newTodo);
this.newTodo = '';
}
}
delete(key: string) {
this.todos.get(key).put(null);
}
sub() {
this.todosSub = this.todos$.subscribe(v => console.log(v));
}
unsub() {
this.todosSub.unsubscribe();
}
}
================================================
FILE: examples/angular/src/app/app.module.ts
================================================
import { BrowserModule } from '@angular/platform-browser';
import { NgModule, Injectable } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { NgPipesModule } from 'ngx-pipes';
import { AppComponent } from './app.component';
import { GunDb } from 'app/gun.service';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule,
HttpModule,
NgPipesModule
],
providers: [GunDb],
bootstrap: [AppComponent]
})
export class AppModule { }
================================================
FILE: examples/angular/src/app/gun.helper.ts
================================================
import { Observable } from 'rxjs/Observable';
import { Gun } from 'gun/gun';
import { pick } from 'underscore';
export function on$(node, cleanup = true): Observable<any> {
return Observable.fromEventPattern(
h => {
// there is no way to off() an on() until at least one value is triggered
// so that we can access the event listener to off() it
const signal = { stop: false };
node.on((data, key, at, ev) => {
if (signal.stop) {
ev.off();
} else {
// modifying data directly does not seem to work...
h(cleanup ? pick(data, (v, k, o) => v !== null && k !== '_') : data);
}
});
return signal;
},
(h, signal) => { signal.stop = true; }
);
}
export function val$(node): Observable<any> {
return new Observable(o => node.val(v => {
o.next(v);
o.complete();
}));
}
================================================
FILE: examples/angular/src/app/gun.service.ts
================================================
import { NgModule, Injectable } from '@angular/core';
import Gun from 'gun/gun';
@Injectable()
export class GunDb {
readonly gun = Gun(location.origin + '/gun');
}
================================================
FILE: examples/angular/src/assets/.gitkeep
================================================
================================================
FILE: examples/angular/src/environments/environment.prod.ts
================================================
export const environment = {
production: true
};
================================================
FILE: examples/angular/src/environments/environment.ts
================================================
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.
export const environment = {
production: false
};
================================================
FILE: examples/angular/src/index.html
================================================
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Angular</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root>Loading...</app-root>
</body>
</html>
================================================
FILE: examples/angular/src/main.ts
================================================
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
import 'rxjs/add/operator/startWith';
import 'rxjs/add/operator/map';
import 'rxjs/add/observable/fromEventPattern';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);
================================================
FILE: examples/angular/src/polyfills.ts
================================================
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/set';
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.
/** IE10 and IE11 requires the following to support `@angular/animation`. */
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/** Evergreen browsers require these. **/
import 'core-js/es6/reflect';
import 'core-js/es7/reflect';
/** ALL Firefox browsers require the following to support `@angular/animation`. **/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
================================================
FILE: examples/angular/src/styles.css
================================================
/* You can add global styles to this file, and also import other style files */
================================================
FILE: examples/angular/src/test.ts
================================================
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/long-stack-trace-zone';
import 'zone.js/dist/proxy.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/jasmine-patch';
import 'zone.js/dist/async-test';
import 'zone.js/dist/fake-async-test';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
// Unfortunately there's no typing for the `__karma__` variable. Just declare it as any.
declare var __karma__: any;
declare var require: any;
// Prevent Karma from running prematurely.
__karma__.loaded = function () {};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
// Finally, start Karma to run the tests.
__karma__.start();
================================================
FILE: examples/angular/src/tsconfig.app.json
================================================
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "es2015",
"baseUrl": "",
"types": []
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
================================================
FILE: examples/angular/src/tsconfig.spec.json
================================================
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"module": "commonjs",
"target": "es5",
"baseUrl": "",
"types": [
"jasmine",
"node"
]
},
"files": [
"test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
================================================
FILE: examples/angular/src/typings.d.ts
================================================
/* SystemJS module definition */
declare var module: NodeModule;
interface NodeModule {
id: string;
}
================================================
FILE: examples/angular/tsconfig.json
================================================
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
================================================
FILE: examples/angular/tslint.json
================================================
{
"rulesDirectory": [
"node_modules/codelyzer"
],
"rules": {
"callable-types": true,
"class-name": true,
"comment-format": [
true,
"check-space"
],
"curly": true,
"eofline": true,
"forin": true,
"import-blacklist": [true, "rxjs"],
"import-spacing": true,
"indent": [
true,
"spaces"
],
"interface-over-type-literal": true,
"label-position": true,
"max-line-length": [
true,
140
],
"member-access": false,
"member-ordering": [
true,
"static-before-instance",
"variables-before-functions"
],
"no-arg": true,
"no-bitwise": true,
"no-console": [
true,
"debug",
"info",
"time",
"timeEnd",
"trace"
],
"no-construct": true,
"no-debugger": true,
"no-duplicate-variable": true,
"no-empty": false,
"no-empty-interface": true,
"no-eval": true,
"no-inferrable-types": [true, "ignore-params"],
"no-shadowed-variable": true,
"no-string-literal": false,
"no-string-throw": true,
"no-switch-case-fall-through": true,
"no-trailing-whitespace": true,
"no-unused-expression": true,
"no-use-before-declare": true,
"no-var-keyword": true,
"object-literal-sort-keys": false,
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-whitespace"
],
"prefer-const": true,
"quotemark": [
true,
"single"
],
"radix": true,
"semicolon": [
"always"
],
"triple-equals": [
true,
"allow-null-check"
],
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
}
],
"typeof-compare": true,
"unified-signatures": true,
"variable-name": false,
"whitespace": [
true,
"check-branch",
"check-decl",
"check-operator",
"check-separator",
"check-type"
],
"directive-selector": [true, "attribute", "app", "camelCase"],
"component-selector": [true, "element", "app", "kebab-case"],
"use-input-property-decorator": true,
"use-output-property-decorator": true,
"use-host-property-decorator": true,
"no-input-rename": true,
"no-output-rename": true,
"use-life-cycle-interface": true,
"use-pipe-transform-interface": true,
"component-class-suffix": true,
"directive-class-suffix": true,
"no-access-missing-member": true,
"templates-use-public": true,
"invoke-injectable": true
}
}
================================================
FILE: examples/axe.html
================================================
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0" />
<title>Testing AXE</title>
</head>
<body>
<h3 id="pid"></h3>
<script src="../gun.js"></script>
<script src="../axe.js"></script>
<script src="../lib/radix.js"></script>
<script src="../lib/webrtc.js"></script>
<!-- <script src="../sea.js"></script> -->
<script>
var pid = location.hash.slice(1);
var opt = ({
peers: [`${location.origin}/gun`]
});
if (pid) { opt.pid = pid; }
Gun.on('opt', function(ctx) {
this.to.next(ctx);
ctx.on('hi', function(opt) {
// console.log('HI!! PEER', new Date(), opt.pid);
setTimeout(function() {
document.getElementById('pid').innerHTML = gun._.opt.pid;
});
});
// if (pid) {
// ctx.on('out', function(msg) {
// msg.pid = pid;
// this.to.next(msg);
// });
// }
});
var gun = Gun(opt);
//var user = gun.user();
</script>
</body>
</html>
================================================
FILE: examples/basic/chat.html
================================================
<!DOCTYPE html>
<ul id='list'></ul>
<form id='form'>
<input id='who' placeholder='name'>
<input id='what' placeholder='say'>
<input type='submit' value='send'>
</form>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/axe.js"></script>
<script src="https://cdn.jsdelivr.net/npm/emojione@4.0.0/lib/js/emojione.min.js"></script>
<script>
gun = GUN(), chat = gun.get("note" + location.hash.replace('#','/')), view = document;
form.onsubmit = (eve) => { chat.set(who.value+': '+what.value), eve.preventDefault(what.value = "") }
chat.map().on(function show(data, id){
(view.line = view.getElementById(id) || view.createElement("li")).id = id;
list.appendChild(view.line).innerText = emojione.shortnameToUnicode(data);
window.scroll(0, list.offsetHeight);
(list.beep = new SpeechSynthesisUtterance()).text = "new";
list.beep.rate = 10, list.beep.pitch = 2, window.speechSynthesis.speak(list.beep);
});
</script>
================================================
FILE: examples/basic/emoji.html
================================================
<!DOCTYPE html>
<p>Moved to <a href="./chat.html">./chat.html</a>!</p>
================================================
FILE: examples/basic/meet.html
================================================
<!DOCTYPE html>
<center>must press play or unmute on new videos to accept meeting</center>
<center id="videos">
<video id="me" width="100%" controls autoplay playsinline muted></video>
</center>
<center>Stream <select id="select"><option id="from">from</option></select></center>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/sea.js"></script>
<script src="../../../gun/lib/webrtc.js"></script>
<script>;(async function(){
streams = {}, gun = Gun(location.origin + '/gun'); //gun = GUN();
mesh = gun.back('opt.mesh');
(await (me.stream = navigator.mediaDevices).enumerateDevices()).forEach((device,i) => {
if('videoinput' !== device.kind){ return }
var opt = $(from).clone().prependTo('select').get(0);
$(opt).text(opt.id = device.label || 'Camera '+i);
opt.value = device.deviceId;
});
$('select').on('change', async eve => { $(from).text('Off'); // update label
if('Off' == select.value){ return me.srcObject.getTracks()[0].stop() }
mesh.hi(me.srcObject = await me.stream.getUserMedia({ audio: true,
video: (select.value && {deviceId: {exact: select.value}}) || {facingMode: "environment"}
}));
});
gun.on('rtc', async function(eve){ var ui, src;
console.log("?RTC?", eve.peer && eve.peer.connectionState, eve);
if(!(src = eve.streams)){ return }
ui = $('#v'+(src=src[0]).id).get(0) || $(me).clone().attr('id', 'v'+src.id).prependTo('#videos').get(0); // reuse or create video element
ui.srcObject = src;
});
}());</script>
================================================
FILE: examples/basic/note.html
================================================
<!DOCTYPE html>
<style>html, body, textarea { width: 100%; height: 100%; padding: 0; margin: 0; }</style>
<textarea id="view" placeholder="write here..."></textarea>
<script src="../../../gun/gun.js"></script><script>
gun = GUN(location.origin + '/gun');
note = gun.get('note').get(location.hash.replace('#','')||1);
view.oninput = () => { note.put(view.value) };
note.on((data) => { view.value = data });
</script>
================================================
FILE: examples/basic/paste.html
================================================
<!DOCTYPE html>
<p>Moved to <a href="./note.html">./note.html</a>!</p>
================================================
FILE: examples/basic/poll.html
================================================
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/sea.js"></script>
<!-- script src="../../../gun/axe.js"></script -->
<script> // main init!
var app = {
view: $, // replace with not jquery!
data: GUN('http://localhost:8765/gun'), // peer-to-peer database!
};
app.user = app.data.user().recall({sessionStorage: true});
</script>
</head>
<body>
<div id="login" class="center pad">
<style>
#login input {
max-width: 6em;
}
</style>
<form id="sign" onsubmit="app.login(event)">
<input id="alias" placeholder="username" class="jot rim">
<input id="pass" type="password" placeholder="passphrase" class="jot rim">
<input id="in" type="submit" value="sign in" class="green whitet act gap sap rim">
<input id="up" type="button" value="sign up" onclick="app.register()" class="act gap sap rim">
</form>
<script>
app.login = function(eve){
if(app.error(eve)){ return }
app.data.user().auth(
app.view('#alias').val(),
app.view('#pass').val(),
app.error
);
};
app.register = function(eve){
app.data.user().create(
app.view('#alias').val(),
app.view('#pass').val(),
app.login
);
};
app.data.on('auth', function(eve){
app.view('#sign').hide(); // hide login form upon logging in.
});
</script>
</div>
<div id="poll" class="pad">
<style>
#poll {
display: flex;
flex-wrap: wrap;
}
#poll div {
margin: 1%;
width: 100%;
}
</style>
<script>
(window.onhashchange = async function(){
app.poll = app.data.get(location.hash.slice(1));
app.poll.map().on(function(data, id){
app.render(id = 'p'+String.hash(id), '.q', '#poll', data).css({order: data.how}).data('as',{$:this});
console.log("poll?", id, data);
});
})();
app.render = function(id, model, onto, data){
var ui = $(
$('#'+id).get(0) ||
$('.model').find(model).clone(true).attr('id', id).appendTo(onto)
);
$.each(data, function(field, val){
if($.isPlainObject(val)){ return }
ui.find("[name='" + field + "']").val(val).text(val);
});
return ui;
}
</script>
<div class="model">
<div class="q">
<span name="what"></span>
</div>
</div>
</div>
<div id="make" class="pad">
<style>
#make #add {
border-radius: 100%;
width: 2em;
height: 2em;
line-height: 0em;
padding: 0;
margin: 0;
text-align: center;
}
</style>
<button id="add" onclick="app.add()" class="green whitet act">+</button>
<span class="hint">add new title, text, question...</span>
<script>
app.add = async function(){
if(app.error(app.user)){ return }
var tmp = await (app.poll = app.poll || app.data.get(location.hash.slice(1)));
if(!tmp){ app.poll = app.user.get('poll').set({}) }
app.poll.set({how: tmp = Object.keys(tmp||'').length || 1, what: "Question " + tmp });
if(!location.hash){ location.hash = (await app.poll)._['#'] }
}
</script>
</div>
<span id="error">
<span id="err"></span>
<script>
app.error = function(eve){
app.view('#err').text('').hide();
if(!eve){ return }
if(eve.preventDefault){
eve.preventDefault();
return;
}
if(eve._ && !eve.is){ eve = {err: "Not signed in!"} }
if(!eve.err){ return }
app.view('#err').text(eve.err).show();
return true;
}
</script>
</span>
<style>
#error { position: fixed; top: 0; width: 100%; text-align: center; background: white; }
</style>
<link rel="stylesheet" href="../style.css"/>
<style>
@import url('https://fonts.googleapis.com/css?family=Oxygen');
html, body { font-family: "Oxygen", sans-serif; }
</style>
</body>
</html>
================================================
FILE: examples/basic/post.html
================================================
<!DOCTYPE html>
<h1>Posts</h1>
<form id="sign">
<input id="alias" placeholder="username">
<input id="pass" type="password" placeholder="passphrase">
<input id="in" type="submit" value="sign in">
<input id="up" type="button" value="sign up">
</form>
<form id="said">
<input id="say" placeholder="write here...">
<input id="speak" type="submit" value="say">
</form>
<ul></ul>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/sea.js"></script>
<script src="../../../gun/axe.js"></script>
<script>
gun = GUN(), user = gun.user().recall({sessionStorage: true});
$('#sign').on('submit', login);
$('#up').on('click', () => { user.create($('#alias').val(), $('#pass').val(), login) });
function login(eve){
eve.preventDefault();
user.auth($('#alias').val(), $('#pass').val());
};
gun.on('auth', () => { $('#sign').hide(), user.get('said').map().on(show) });
function show(data, id){
return ($('#' + id).get(0) || $('<li>').attr('id', id).prependTo('ul')).text(data);
};
$('#said').on('submit', (eve) => {
eve.preventDefault();
if(!user.is){ return }
user.get('said').set($('#say').val());
$('#say').val("");
});
</script>
================================================
FILE: examples/basic/private.html
================================================
<!DOCTYPE html>
<style>
html, body {
background: rgb(245, 245, 245);
margin: 0;
padding: 0;
}
div {
position: relative;
overflow: hidden;
}
#top {
background: #283e4a;
height: 52px;
width: 100%;
}
.box {
border-radius: 3px;
box-shadow: 0px 0px 3px #777;
background: white;
max-width: 36em;
margin: 0 auto;
min-height: 10em;
margin-bottom: 0.5em;
}
.color {
background: #2977b5;
height: 7em;
width: 100%;
}
.pad {
margin: 1em;
}
.none { display: none; }
input {
font-size: 1em;
margin: 0.1em;
}
</style>
<div id="top">
<center>
<input id="search" placeholder="search by pub or DID">
</center>
</div>
<div class="box">
<div class="color"></div>
<div class="pad">
<form id="sign">
<h1>Login</h1>
<input id="alias" placeholder="username">
<input id="pass" type="password" placeholder="passphrase">
<input id="in" type="submit" value="sign in">
<input id="up" type="button" value="sign up">
</form>
<form id="profile" class="none">
<h1>Profile</h1>
<p>Data is privately encrypted by default. "+" to grant access, "x" to revoke access.</p>
<input id="name" placeholder="name"> <button>+</button><br/>
<input id="born" placeholder="born"> <button>+</button><br/>
<input id="edu" placeholder="education"> <button>+</button><br/>
<input id="skills" placeholder="skills"> <button>+</button><br/>
</form>
</div>
</div>
<div class="box"><div class="pad">
Public Key: <input id="pub">
</div></div>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/sea.js"></script>
<script>
// extend SEA functions to base64 encode encrypted data
// workaround for https://github.com/amark/gun/issues/783
(() => {
const _encrypt = SEA.encrypt;
SEA.encrypt = function(...args) {
return _encrypt.apply(this, args).then(enc => btoa(JSON.stringify(enc)));
}
const _decrypt = SEA.decrypt;
SEA.decrypt = function(data, ...args) {
try { data = JSON.parse(atob(data)); }
finally { return _decrypt.apply(this, [data, ...args]); }
}
})();
// override User functions to fix several issues
// see https://github.com/amark/gun/issues/808
SEA.Gun.User.prototype.grant = function grant(to, cb) {
const gun = this; const user = gun.back(-1).user();
const pair = user._.sea; let path = '';
gun.back(at => { if (at.has) { path += at.get; } });
(async () => {
let enc, sec;
if (sec = await user.get('trust').get(pair.pub).get(path).then()) {
sec = await SEA.decrypt(sec, pair);
} else {
sec = SEA.random(24).toString();
enc = await SEA.encrypt(sec, pair);
user.get('trust').get(pair.pub).get(path).put(enc);
}
let pub = to.get('pub') .then();
let epub = to.get('epub').then();
pub = await pub; epub = await epub;
const dh = await SEA.secret (epub, pair);
enc = await SEA.encrypt(sec, dh);
// if pub is not already in trust, first put an empty node
// workaround for https://github.com/amark/gun/issues/844
if (!await user.get('trust').get(pub).then()) {
await user.get('trust').get(pub).get(path).put({}).then();
}
user.get('trust').get(pub).get(path).put(enc, cb);
})();
return gun;
}
SEA.Gun.User.prototype.secret = function(data, cb) {
const gun = this; const user = gun.back(-1).user();
const pair = user._.sea; let path = '';
gun.back(at => { if (at.has) { path += at.get; } });
(async () => {
let enc, sec;
if (sec = await user.get('trust').get(pair.pub).get(path).then()) {
sec = await SEA.decrypt(sec, pair);
} else {
sec = SEA.random(24).toString();
enc = await SEA.encrypt(sec, pair);
user.get('trust').get(pair.pub).get(path).put(enc);
}
enc = await SEA.encrypt(data, sec);
gun.put(enc, cb);
})();
return gun;
}
var gun = Gun('http://localhost:8765/gun');
var user = gun.user();
var LI = {};
user.recall({sessionStorage: true});
$('#up').on('click', function(e){
user.create($('#alias').val(), $('#pass').val());
});
$('#sign').on('submit', function(e){
e.preventDefault();
user.auth($('#alias').val(), $('#pass').val());
});
gun.on('auth', function(){
$('#sign').hide();
$('#profile').show();
var pub = user._.sea.pub;
$('#pub').val(pub);
return;
$("#search").val(pub).trigger('blur');
});
$('#profile input').on('keyup', function(e){
if(!user.is){ return }
var id = LI.busy = $(this).attr('id');
user.get('profile').get(id).secret($(this).val());
}).on('blur', function(){ LI.busy = false })
$('#profile button').on('click', async function(e){
e.preventDefault();
if(!user.is){ return }
var b = $(this);
var id = b.prev().attr('id');
var pub = prompt("What is the Public Key or DID you want to give read access to?");
var to = gun.user(pub);
var who = await to.get('alias').then();
if(!confirm("You want to give access to " + who + "?")){ return }
user.get('profile').get(id).grant(to);
});
$('#search').on('blur', function(e){
var s = LI.search = $(this).val();
var find = gun.user(s);
find.get('profile').on(function(data, key, at, ev){
if(s !== LI.search){
ev.off();
return;
}
Gun.node.is(data, async (enc, id) => {
if (id === LI.busy) { return; }
const pair = user._.sea;
let key, val;
if (key =
await find.get('trust').get(pair.pub).get(id + 'profile').then()) {
const mix = await Gun.SEA.secret(await find.get('epub').then(), pair);
key = await Gun.SEA.decrypt(key, mix);
val = await Gun.SEA.decrypt(enc, key);
// decode encrypted data to show 'SEA{...}'
} else { val = JSON.parse(atob(enc)); }
$('#' + id).val(val);
});
});
});
</script>
================================================
FILE: examples/basic/schedule.html
================================================
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link href='https://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
</head>
<body>
<h1><button id="left">←</button> <span id="date"></span> Schedule <button id="right">→</button></h1>
<form id="add">
<style>input[type="number"]{ width: 4em; }</style>
<input id="what" placeholder="What?">
<input id="where" placeholder="Where?">
<input type="number" id="hour"><script>hour.value = new Date().getHours() % 12 || 12</script> :
<input type="number" id="min" value="0">
<select id="ampm">
<option value="">am</option>
<option value="1">pm</option>
<script>ampm.children[new Date().getHours() < 12? 0 : 1].selected='selected'</script>
</select>
<input id="id" type="hidden">
<input id="go" type="submit" value="add">
<div id="err"></div>
</form>
<style>
.none { display: none; }
p, ul, li { list-style-type: none; margin: 0; padding: 0; }
</style>
<ul></ul>
<div class="model none">
<li>
<b class="when"></b>
<span class="what"></span>
<u class="where"></u>
<span class="sort none">0</span>
<button class="edit"><</button>
</li>
</div>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/nts.js"></script>
<script src="../../../gun/lib/webrtc.js"></script>
<script>
var name = 'schedule/' + location.hash.slice(1);
var gun = Gun(location.origin + '/gun');
//var gun = Gun('http://localhost:8765/gun');
//var gun = Gun();
$('#add').on('submit', function(event){
event.preventDefault();
event = {};
if(!schedule.on){ return err.innerText = "No date!" }
event.when = new Date(schedule.on.getFullYear(), schedule.on.getMonth(), schedule.on.getDate(), hour.value % 12 + (ampm.value? 12 : 0), min.value).getTime();
if(!(event.what = what.value)){ return err.innerText = "No description!" }
if(!(event.where = where.value)){ return err.innerText = "No location!" }
var day = gun.get(name+now(event.when));
day.get(id.value || String.random(9)).put(event);
what.value = where.value = id.value = err.innerText = '';
go.value = 'add';
schedule(event.when);
});
function schedule(ms){
var day = new Date(ms);
if(schedule.on && schedule.on.toLocaleDateString() === day.toLocaleDateString()){ return } schedule.on = day;
$('#date').text(day.getFullYear()+' '+ day.toString().split(' ')[1] +' '+day.getDate());
day = gun.get(name+now(ms));
$('ul').empty();
day.map().on(UI);
}
schedule(+new Date());
$('#left').on('click', function(){ schedule(+new Date(schedule.on.getFullYear(), schedule.on.getMonth(), schedule.on.getDate() - 1)) });
$('#right').on('click', function(){ schedule(+new Date(schedule.on.getFullYear(), schedule.on.getMonth(), schedule.on.getDate() + 1)) });
function UI(event, id){
if(!event){ return }
var when = new Date(event.when);
if(schedule.on && when.toLocaleDateString() !== schedule.on.toLocaleDateString()){ return }
var ul = $('ul')
var li = $("#cal-" + id)[0]; // grab if exists
if(!li){
li = $('.model li').clone(true) // else create it
.attr('id', 'cal-' + id);
}
li = (UI.last = sort(event.when, ul.children('li').last())[0])? $(li).insertAfter(UI.last) : $(li).prependTo(ul);
li.find('.what').text(event.what);
li.find('.where').text(event.where);
li.find('.sort').text(event.when);
li.find('.edit').val(id);
var time = when.toLocaleTimeString();
li.find('.when').text(time.split(':').slice(0,2).join(':') + time.slice(-2));
};
$(document).on('click', '.edit', function(){
go.value = 'update';
id.value = this.value;
what.value = $(this).parent().find('.what').text();
where.value = $(this).parent().find('.where').text();
var when = new Date(parseFloat($(this).parent().find('.sort').text()));
hour.value = when.getHours() % 12 || 12;
min.value = when.getMinutes();
ampm.value = when.getHours() < 12? '' : 1;
what.focus();
});
function now(t){
return new Date(t || Gun.state()).toLocaleDateString().split('/').reverse().join('/')
}
function sort(num, li){ return parseFloat(num) >= parseFloat($(li).find('.sort').text() || -Infinity)? li : sort(num, li.prev()) }
</script>
</body>
</html>
================================================
FILE: examples/basic/screen.html
================================================
<!DOCTYPE html>
<video id="video" width="100%"></video>
<center>
<button id="record">Record</button>
<button id="play">Play</button>
</center>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script>
var gun = Gun(location.origin + '/gun');
var record = {recorder: null, recording: false};
$('#record').on('click', ()=>{
if(!record.ing){ return record.stream() }
$('#record').text("Record");
if(record.ing.stop){ record.ing.stop() }
record.ing = false;
})
record.stream = function(){
navigator.mediaDevices.getDisplayMedia({ video: true }).then(stream => {
var chunks = []; // we have a stream, we can record it
record.ing = new MediaRecorder(stream);
record.ing.ondataavailable = eve => chunks.push(eve.data);
record.ing.onstop = eve => record.save(new Blob(chunks));
record.ing.start()
$('#record').text("End");
}, err => { console.log(err) });
}
record.save = function(data){
record.file = record.file || new FileReader();
record.file.readAsDataURL(data);
record.file.onloadend = function(){
var b64 = record.file.result;
b64 = "data:video/webm" + b64.slice(b64.indexOf(';'));
gun.get('test').get('screen').put(b64);
}
}
$('#play').on('click', ()=>{
if(record.playing){
$('#play').text("Play")
$('#video').get(0).stop();
record.playing = false;
return;
}
$('#play').text("Stop");
record.playing = true;
gun.get('test').get('screen').once((data)=>{
if(!data){ return }
$('#video').get(0).src = data;
$('#video').get(0).play()
})
})
</script>
================================================
FILE: examples/basic/stream.html
================================================
<!DOCTYPE html>
<center>
<img id="img" width="100%"><br/>
Stream <select id="select"><option id="from">from</option></select>
add <input id="pass" placeholder="password" type="password">
resolution <input id="res" value="240" step="32" max="1080" type="number" style="width:3em;">
or <input id="upload" type="file">
</center>
<video id="video" width="100%" controls autoplay style="display: none;"></video>
<canvas id="canvas" width="0" style="display: none;"></canvas>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/sea.js"></script>
<script src="../../../gun/lib/webrtc.js"></script>
<script>;(async function(){
gun = Gun(location.origin + '/gun'); //gun = GUN();
stream = canvas.getContext('2d'), stream.from = navigator.mediaDevices;
(await stream.from.enumerateDevices()).forEach((device,i) => {
if('videoinput' !== device.kind){ return }
var opt = $(from).clone().prependTo('select').get(0);
$(opt).text(opt.id = device.label || 'Camera '+i);
opt.value = device.deviceId;
});
$('select').on('change', async eve => { $(from).text('Off'); // update label
if('Off' == select.value){ return video.srcObject.getTracks()[0].stop() }
video.srcObject = await stream.from.getUserMedia({ audio: false,
video: (select.value && {deviceId: {exact: select.value}}) || {facingMode: "environment"}
});
});
$('#upload').on('change', async eve => { console.log("Check ./upload.html") })
setInterval(async tmp => {
if(!(video.srcObject||'').active){ return }
var size = parseInt(res.value);
stream.drawImage(video, 0,0,
canvas.width = size || video.videoWidth * 0.1,
canvas.height = (size * (video.videoHeight/video.videoWidth)) || video.videoHeight * 0.1
);
var b64 = canvas.toDataURL('image/jpeg');
if(pass.value){ b64 = await SEA.encrypt(b64, pass.value) }
gun.get('test').get('video').put(b64);
}, 99);
gun.get('test').get('video').on(async data => {
if(pass.value){ data = await SEA.decrypt(data, pass.value) }
img.src = data; // Beware: Some browsers memory leak fast src updates.
});
// === AUDIO STREAMING WITH FADE-IN/OUT ===
const audioCtx = new (window.AudioContext || window.webkitAudioContext)();
const mic = await stream.from.getUserMedia({ audio: true });
const src = audioCtx.createMediaStreamSource(mic);
const proc = audioCtx.createScriptProcessor(2048, 1, 1);
src.connect(proc);
proc.connect(audioCtx.destination);
proc.onaudioprocess = async e => {
const input = e.inputBuffer.getChannelData(0);
const output = new Float32Array(input.length);
const fade = 128;
for (let i = 0; i < fade; i++) {
output[i] = input[i] * (i / fade); // fade in
}
for (let i = fade; i < input.length - fade; i++) {
output[i] = input[i]; // middle
}
for (let i = input.length - fade; i < input.length; i++) {
output[i] = input[i] * ((input.length - i) / fade); // fade out
}
const int16 = new Int16Array(output.length);
for (let i = 0; i < output.length; i++) {
int16[i] = Math.max(-32768, Math.min(32767, output[i] * 32768));
}
let b64 = btoa(String.fromCharCode(...new Uint8Array(int16.buffer)));
if(pass.value){ b64 = await SEA.encrypt(b64, pass.value) }
gun.get('test').get('audio').put(b64);
};
gun.get('test').get('audio').on(async data => {
if(!data) return;
if(pass.value){ data = await SEA.decrypt(data, pass.value) }
const bin = atob(data);
const bytes = new Uint8Array(bin.length);
for(let i=0; i<bin.length; i++){ bytes[i] = bin.charCodeAt(i) }
const buf = audioCtx.createBuffer(1, bytes.length / 2, 44100);
const chan = buf.getChannelData(0);
for(let i=0; i<chan.length; i++){
const s = (bytes[i*2+1] << 8) | bytes[i*2];
chan[i] = (s > 32767 ? s - 65536 : s) / 32768;
}
const player = audioCtx.createBufferSource();
player.buffer = buf;
player.connect(audioCtx.destination);
player.start();
});
}());</script>
================================================
FILE: examples/basic/tables.html
================================================
<!DOCTYPE html>
<h1>Tables</h1>
<form id="sign">
<input id="alias" placeholder="username">
<input id="pass" type="password" placeholder="passphrase">
<input id="in" type="submit" value="sign in">
<input id="up" type="button" value="sign up">
</form>
<button id="tadd">+ table</button>
<ul></ul><br/>
<div id="table"></div>
<button id="radd">+ row</button>
<button id="cadd">+ col</button>
<style>
div {
position: relative;
overflow: hidden;
}
.cell {
width: 5em;
height: 5em;
border: 1px solid black;
float: left;
}
.item {
float: left;
min-width: 5em;
}
</style>
<div class="model" style="display: none;">
<div class="item"></div>
<div class="cell"></div>
<div class="row"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/gun/examples/jquery.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/gun.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/sea.js"></script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/open.js"></script>
<script>
//var gun = Gun(['http://localhost:8080/gun']);
var gun = Gun();
var user = gun.user();
$('#up').on('click', function(e){
user.create($('#alias').val(), $('#pass').val());
});
$('#sign').on('submit', function(e){
e.preventDefault();
user.auth($('#alias').val(), $('#pass').val());
});
user.recall({sessionStorage: true});
gun.on('auth', function(){
$('#sign').hide();
user.get('tables').map().once(list);
});
$('#tadd').on('click', function(e){
if(!user.is){ return alert("login first") }
var cell = user.get('cells').set({what: "Edit me!", sort: 1});
var row = user.get('rows').set({sort: 1});
row.get('cells').set(cell);
var name = prompt("What do you want to call this table?")
var table = user.get('tables').set({name: name});
table.get('rows').set(row);
choose(table);
});
$(document).on('click', '.item', function(){
choose($(this).data('$'));
});
function choose(table){
choose.table = table;
table.open(render);
}
function render(data){
console.log(data);
$('#table').empty(); // BAD! Write DOM-diffing!
Gun.obj.map(data.rows, function(row, id){
var $r = grab(id, '.model .row', '#table');
Gun.obj.map(row.cells, function(cell, id){
var $c = grab(id, '.model .cell', $r);
$c.text(cell.what);
});
});
}
$(document).on('click', '.cell', function(e){
var id = $(this).data('id'), ref = gun.get(id);
var what = prompt("What should be in this cell?");
ref.get('what').put(what);
});
$('#radd').on('click', function(){
if(!user.is){ return alert("login first") }
choose.table.get('rows').set();
var cell = user.get('cells').set({what: "Edit me!", sort: 1});
var row = user.get('rows').set({sort: 1});
row.get('cells').set(cell);
choose.table.get('rows').set(row);
});
$('#cadd').on('click', function(){
if(!user.is){ return alert("login first") }
choose.table.get('rows').map().once(function(){
var cell = user.get('cells').set({what: "Edit me!", sort: 1});
this.get('cells').set(cell);
});
});
function grab(id, $model, $to){
var did = btoa(id).replace(/[\+\-\=\.]/ig,'');
return $('#' + did).get(0) || $($model).clone(true, true).attr('id', did).appendTo($to).data('id', id);
};
function list(table, id, $model, $to){
var li = grab(id, '.model .item', 'ul');
$(li).text(table.name).data('$', this);
};
</script>
================================================
FILE: examples/basic/upload.html
================================================
<!DOCTYPE html>
<div class="model" style="display: none;">
<video width="100%" controls autoplay></video>
<audio width="100%" controls autoplay></audio>
<img style="max-width: 100%;">
</div>
<center>
<p>Drag & drop videos, songs, or images! <input id="upload" type="file" multiple></p>
</center>
<script src="../../../gun/lib/yson.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/lib/dom.js"></script>
<script src="../../../gun/lib/upload.js"></script>
<script>
gun = GUN(location.origin + '/gun');
$('html, #upload').upload(function resize(eve, up){
if(up){ return up.shrink(eve, resize, 1024) }
var b64 = (eve.base64 || ((eve.event || eve).target || eve).result || eve); // which one? try all!
gun.get('test').get((eve.id+(new Date).getUTCSeconds()) % 60).put(b64); // limit uploads to 1 of 60 slots.
});
gun.get('test').map().once(function(data){
if("string" != typeof data){ return }
var type = data.split(';')[0], ui;
if(type.indexOf('image') + 1){ ui = $("img").get(0) }
if(type.indexOf('video') + 1){ ui = $('video').get(0) }
if(type.indexOf('audio') + 1){ ui = $('audio').get(0) }
if(!ui){ return }
$(ui).clone().prependTo('center').get(0).src = data;
});
</script>
================================================
FILE: examples/basic/user.html
================================================
<!DOCTYPE html>
<p>Moved to <a href="./post.html">./post.html</a>!</p>
================================================
FILE: examples/basic/video.html
================================================
<!DOCTYPE html>
<video id="video" width="100%" controls autoplay></video>
<center>
<input id="pass" placeholder="password">
Record <button class="record">Camera</button> or <button class="record">Screen</button>
</center>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<script src="../../../gun/sea.js"></script>
<script>
var gun = Gun(location.origin + '/gun');
gun.get('test').get('video').on(async function(data){
if($('#pass').val()){ data = await SEA.decrypt(data, $('#pass').val()) }
$('#video').get(0).src = data;
})
$('.record').on('click', function(){
if(record.ing){
if(record.ing.stop){ record.ing.stop() }
$(this).text(record.type);
record.ing = false;
return;
}
record(record.type = $(this).text());
$(this).text("End");
})
function record(type){
if('Camera' === type){
navigator.getMedia({ video: true, audio: true }, load, error);
}
if('Screen' === type){
navigator.mediaDevices.getDisplayMedia({ video: true, audio: true }).then(load, error);
}
function load(media){
var chunks = [];
record.ing = new MediaRecorder(media);
record.ing.ondataavailable = function(eve){ chunks.push(eve.data) }
record.ing.onstop = function(eve){record.save(new Blob(chunks)) }
record.ing.start();
}
function error(err){ console.log(err) }
}
record.save = function(data){
record.file = record.file || new FileReader();
record.file.readAsDataURL(data);
record.file.onloadend = async function(){
var b64 = record.file.result, pass;
b64 = $('#video').get(0).src = "data:video/webm" + b64.slice(b64.indexOf(';'));
if($('#pass').val()){ b64 = await SEA.encrypt(b64, $('#pass').val()) }
gun.get('test').get('video').put(b64);
}
}
navigator.getMedia = (navigator.getUserMedia || navigator.webkitGetUserMedia
|| navigator.mozGetUserMedia || navigator.msGetUserMedia);
</script>
================================================
FILE: examples/chat/index.html
================================================
<!DOCTYPE html>
<html>
<head>
<title>Converse</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" type="text/css" href="/style.css">
<link href='https://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<style>
.chat__heading {
position: fixed;
text-align: center;
z-index: 1;
width: 100%;
margin-top: 0;
margin-bottom: 0;
}
.chat__form-container {
display: flex;
justify-content: center;
width: 100%;
padding: 10px 20px;
position: fixed;
z-index: 1;
bottom: 0;
}
.chat__form {
display: flex;
justify-content: center;
height: 50px;
background-color: white;
border: 2px solid white;
max-width: 900px;
width: 100%;
border-radius: 5px;
}
.chat__name-input {
flex: 1;
padding: 10px;
}
.chat__message-input {
flex: 5;
padding: 10px;
}
.chat__submit {
padding: 10px;
color: white;
border-radius: 5px;
}
.chat__submit:hover::after {
background-color: rgba(0,0,0,0.2);
}
.chat__submit:focus::after {
background-color: rgba(0,0,0,0.2);
}
.chat__submit::after {
content: '';
position: absolute;
width: 100%;
height: 100%;
left: 0;
top: 0;
border-radius: 5px;
transition: background-color 0.3s;
background-color: rgba(0,0,0,0);
}
.chat__message-list {
display: flex;
flex-direction: column;
align-items: center;
flex: 1;
overflow-y: auto;
padding: 60px 20px;
width: 100%;
background-color: rgba(0, 0, 0, 0.2);
min-height: 100vh;
}
.chat__message {
display: flex;
flex-wrap: wrap;
margin-bottom: 10px;
padding: 10px;
border-radius: 5px;
width: 100%;
position: relative;
max-width: 900px;
}
.chat__name {
margin-right: 20px;
}
.chat__when {
position: absolute;
top: 0;
right: 2em;
padding: 10px;
background: rgba(100%, 100%, 100%, 0.9);
opacity: 0;
border-radius: 5px;
}
.chat__message:hover .chat__when {
opacity: 1;
right: 0em;
}
@media (max-width: 567px) {
.chat__heading {
font-size: 30px;
}
}
</style>
</head>
<body>
<div class="chat hue2 page">
<h2 id='title' class="chat__heading hue2 whitet">Have a Conversation...</h2>
<ul class="chat__message-list">
<li class="none"></li>
</ul>
<div class="chat__form-container hue2">
<form class="chat__form">
<label for="name-input" class="visually-hidden">Name</label>
<input id="name-input" class="chat__name-input" placeholder="Name"></input>
<label for="message-input" class="visually-hidden">Message</label>
<input id="message-input" class="chat__message-input" placeholder="Write a message..."></input>
<button class="chat__submit say hue2">say</button>
</form>
</div>
<div class="model">
<li class="chat__message white huet2 box">
<b class="chat__name"></b>
<p class="chat__message-text"></p>
<span class="sort none">0</span>
<div class="chat__when"></div>
</li>
</div>
</div>
<script src="/jquery.js"></script>
<script src="/gun.js"></script>
<script src="/gun/nts.js"></script>
<script>
var gun = Gun(location.origin + '/gun');
var chat = gun.get('converse/' + location.hash.slice(1));
$(".chat__submit").on('click', submit);
$(".chat_form").on('keydown', enter);
function enter(e) {
if (e.which !== 13) { return }
submit(e);
}
function submit(e) {
e.preventDefault();
var msg = { when: Gun.state() };
msg.who = $('.chat__name-input').val();
if (!msg.who) {
msg.who = 'user' + String.random(3);
$('.chat__name-input').val(msg.who);
}
msg.what = $('.chat__message-input').val();
if (!msg.what) { return }
chat.set(msg);
$('.chat__message-input').val('').focus();
}
chat.map().once(function (msg, id) {
if (!msg) { return }
var messageList = $('.chat__message-list');
var last = sort(msg.when, messageList.children('li').last());
var li = $("#msg-" + id)[0]; // grab if exists
if (!li) {
li = $('.model li').clone(true) // else create it
.attr('id', 'msg-' + id)
.insertAfter(last);
}
// bind the message data into the UI
li = $(li);
li.find('.chat__name').text(msg.who);
li.find('.chat__message-text').text(msg.what);
li.find('.sort').text(msg.when);
var time = new Date(msg.when);
li.find('.chat__when').text(time.toDateString() + ', ' + time.toLocaleTimeString());
$('html, body').stop(true, true)
.animate({ scrollTop: messageList.height() });
});
function sort(num, li) { return parseFloat(num) >= parseFloat($(li).find('.sort').text() || -Infinity) ? li : sort(num, li.prev()) }
</script>
</body>
</html>
================================================
FILE: examples/chat/user.html
================================================
<script src="/gun.js"></script>
<!--
<script src="/gun/lib/cryptomodules.js" type="text/javascript"></script>
<script src="/gun/sea.js"></script>
-->
<script>
var gun = Gun(location.origin+'/gun');
var user = gun.user && gun.user();
if(user){
// 1st: call create. 2nd call auth. After that, call recall
// user.create('dude', 'my secret').then(function(ack) { console.log('created ack:', ack) });
// user.recall().then(function(ack){
// if (!ack || !ack.sea){
// console.log('user.recall not bootstrapping...');
// user.auth('dude', 'my secret', {pin: 'PIN'}).then(function(user) { console.log('authenticated user:', user) });
// // user.auth('dude', 'my secret', {pin: 'PIN', newpass: 'my new secret'}).then(function(user) { console.log('authenticated user:', user) });
// } else {
// console.log('user.recall authenticated user:', ack.alias);
// }
// });
}
</script>
================================================
FILE: examples/contact/index.html
================================================
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
</head>
<body>
<div id="sign" class="hue page">
<style>
input, button {
margin: 1em 0;
padding: 1em;
}
.or {
display: inline-block;
width: 15%;
}
</style>
<form id="inup" class="sign pad center">
<div class="loud">Welcome,</div>
<div class="mid row col">
<input name="alias" class="huet jot sap" placeholder="alias">
Enter your public username.
</div>
<div class="mid row col">
<input name="pass" class="huet jot sap" type="password" placeholder="passphrase">
And a long private passphrase.
</div>
<div class="mid row col go">
<button class="huet sap act symbol">sign in</button>
<div class="or">or</div>
<button class="huet sap act symbol">sign up</button>
</div>
<a href="info">more info</a>
</form>
</div id="sign">
<div id="people" class="hue2 page">
<ul name="users" class="pad">
<h3>Here is a list of people:</h3>
<li name="#">
<!-- <h3 name="."></h3> -->
<ul>
<a href="person" name="#" class="whitet act">
<li>
<span name="who">
<b name="name"></b>
</span>
<i>~</i><i name="alias" class="sort"></i>
<input name="pub">
</li>
</a>
</ul>
</li>
</ul>
</div id="people">
<div id="converse" class="page">
<ul>
</ul>
<div class="model">
<li class="msg">
<span name="fro">Alias</span>: <span name="what"></span>
</li>
</div>
<form>
<input placeholder="to" name="to">
<textarea name="what"></textarea>
<input type="submit" value="submit">
<div class="status"></div>
</form>
</div id="converse">
<div id="person" class="hue3 page">
<style>
#person .back {
position: absolute;
top: 0.3em;
left: 0.5em;
width: 2em;
height: 2em;
z-index: 99999;
}
</style>
<a href="people" class="whitet act back">←</a>
<div class="pad">
<div name="who">
<!-- img src="" -->
<h2 name="name" contenteditable="true">Name</h2>
<i name="born"></i>
<span name="bio" contenteditable="true">bio</span>
<form id="say" class="center none">
<input class="jot" placeholder="Say something!" style="width: 80%;">
<input type="submit" id="speak" class="huet2 sap act symbol" style="min-width: 5em; width: 10%;" value="speak">
</form>
<div>
<ul name="said">
<li name="#" class="sit sort shade rim"><div name="what" class="rim"></div></li>
</ul>
</div>
</div>
<input name="pub">
</div>
</div id="person">
<div id="info" class="page">
<p>A mysterious new example app has appeared! It is not finished/ready yet.</p>
</div id="info">
<div id="tell" class="center">
<style>
#tell {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 0;
overflow: visible;
}
#tell p {
top: -2em;
width: 50%;
border: solid #222 0.2em;
border-top: none;
padding: 1%;
opacity: 0;
visibility: hidden;
transition: visibility 2s, all 1s ease-in;
}
#tell .notify {
top: 0em;
opacity: 0.8;
visibility: visible;
transition: visibility 0s, all 0.25s ease-out;
}
</style>
<p class="mid black">Hello world!</p>
</div>
<!-- script src="/Users/mark/Dropbox/Public/gun/db/examples/jquery.js"></script>
<script src="/Users/mark/Dropbox/Public/gun/db/gun.js"></script>
<script src="/Users/mark/Dropbox/Public/gun/db/lib/cryptomodules.js"></script>
<script src="/Users/mark/Dropbox/Public/gun/db/sea.js"></script>
<script src="/Users/mark/Dropbox/Public/gun/db/as.js"></script -->
<script src="/jquery.js"></script>
<script src="/gun.js"></script>
<script src="/gun/sea.js"></script>
<script src="/gun/as.js"></script>
<script src="/gun/nts.js"></script>
<script>
// Check out the interactive tutorial
// for how to build a simplified version
// of this example: https://scrimba.com/c/c2gBgt4
var gun = Gun(location.origin+'/gun');
var app = gun.get('example/contacts/7');
var user = gun.user();
var c = window.c = {};
(function(){
c.hash = location.hash.slice(1);
gun.on('auth', function(at){
if('sign' === c.hash){ c.hash = '' }
as.route(c.hash || 'people');
});
gun.on('secure', function(at){
/* enforce some rules about shared app level data */
if(!at.put || !at.put.users){ return }
var no;
Gun.node.is(at.put.users, function(val, key){
Gun.SEA.verify(val, false, function(val){
//Gun.SEA.read(val, false, function(val){
if('~@'+key === Gun.val.link.is(val)){ return }
no = true;
})
if(no){ return no }
});
if(no){ return }
this.to.next(at);
});
$(document).on('keyup', "form.sign input:first", as.wait(function(){
/*
var form = $(this).closest('form'), data = {alias: $(this).val()};
if(!data.alias || data.alias.length < 5){
return;
}
var exist = gun.path('alias').path(data.alias);
exist.get(function(at){
form.find('.or').addClass('none');
form.find('button:first').toggleClass('none', at.put? false : true);
form.find('button:last').toggleClass('none', at.put? true : false);
});
*/
})).on('click','form.sign button:last', function(){
var but = $(this), form = $(this).closest('form'), data = {alias: form.find('input:first').val(), pass: form.find('input:last').val()};
data.born = Gun.time.is();
if(!data.alias || data.alias.length < 5){
c.tell("Alias needs to be longer than 5 characters.");
return;
}
if(!data.pass || data.pass.length < 9){
c.tell("Passphrase needs to be longer than 9 characters.");
return;
}
but.addClass('pulse');
data.alias = data.alias.toLowerCase();
user.create(data.alias, data.pass, function(ack){
if(!ack.wait){ but.removeClass('pulse') }
if(ack.err){ c.tell(ack.err); return }
if(ack.pub){
gun.get('users').get(data.alias).put(gun.get('~@'+data.alias));
}
session(data);
user.auth(data.alias, data.pass);
});
}).on('click','form.sign button:first', become);
function become(){
var form = $('#sign').find('form'), data = {alias: form.find('input:first').val(), pass: form.find('input:last').val()};
data.alias = data.alias || sessionStorage.alias;
data.pass = data.pass || sessionStorage.tmp;
if(!data.alias || data.alias.length < 5){
c.tell("Alias needs to be longer than 5 characters.");
return;
}
if(!data.pass || data.pass.length < 9){
c.tell("Passphrase needs to be longer than 9 characters.");
return;
}
var but = form.find('button:first');
but.addClass('pulse');
data.alias = data.alias.toLowerCase();
user.auth(data.alias, data.pass, function(ack){
if(!ack.wait){ but.removeClass('pulse') }
if(ack.err){ c.tell(ack.err); return }
session(data);
});
}
if(!location.hash){
as.route('sign');
}
if(!window.sessionStorage){ window.sessionStorage = {clear:function(){}} }
if(sessionStorage.tmp){
become();
}
function session(data){
if(!sessionStorage){ return }
sessionStorage.alias = data.alias;
sessionStorage.tmp = data.pass;
}
c.tell = function(what, n){
var e = $('#tell').find('p');
e.addClass('notify').text(what);
clearTimeout(c.tell.to);
c.tell.to = setTimeout(function(){e.removeClass('notify')}, n || 2500);
}
}());
(function(){
$(document).on('submit', '#say', function(e){
e.preventDefault();
user.get('who').get('said').set({
what: $(this).find('.jot').val()
});
$(this).find('.jot').val('');
});
}());
as.route.page('sign', function(){
$(document.forms.inup.alias).focus();
});
as.route.page('people', function(){
if(!user.is){ return as.route('sign') }
as('#people', gun, function(data, key, el){
if('pub' !== key){ return }
el.closest('a').attr('href', '#person/' + data);
});
});
as.route.page('person', function(){
if(!user.is){ return as.route('sign') }
var pub = location.hash.split('/').slice(-1)[0];
(pub === user._.pub? $('#say').show() : $('#say').hide());
as('#person', window.PUB = gun.get('~'+pub));
});
(function(converse){
as.route.page('converse', function(){
if(!c.me){ return as.route('sign') }
converse.lock = false;
var alias = location.hash.split('/').slice(-1);
$('#converse form').find('input:first').val(alias);
function inbox(msg, id){
if(!sign.verify(msg.pub, msg.what, msg.sig)){ return }
msg.fro = (msg.to === c.me.alias? alias : c.me.alias);
as.route.render(id, '.msg', $('#converse ul'), msg);
}
sign.is(alias, function(acc){
sign.is(c.me.alias).path('msgs').path(acc.pub).map(inbox);
}).path('msgs').path(c.me.pub).map(inbox);
});
$(document).on('submit', '#converse form', function(e){
e.preventDefault();
if(converse.lock){ return console.log('message sending already') }
converse.lock = true; // prevent duplicate sends.
var form = $(this), msg = {};
msg.to = form.find('input:first').val();
msg.what = form.find('textarea').val();
sign.is(msg.to, function(to){
if(!priv){
form.find('.status').text("Failed to send. Please sign in again.");
converse.lock = false;
return;
}
msg.sig = sign.sig(msg.what, priv);
msg.pub = c.me.pub;
msg.when = Gun.time.is();
console.log("sending msg", msg);
sign.is(c.me.alias).path('msgs').path(to.pub).set(gun.put(msg));
converse.lock = false;
}, function(){
form.attr('disabled', false).find('.status').text(msg.to + " cannot be found! Alias is case sensitive.");
converse.lock = false;
});
});
}({}));
//}());</script>
</body>
</html>
================================================
FILE: examples/docs.html
================================================
<!DOCTYPE html>
<html>
<head>
<!-- always start with these two lines to set a clean baseline for different devices -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="style.css">
<script src="jquery.js"></script>
<title>Docs</title>
</head>
<body class="black whitet">
<style>
/*
Choose white text on a black background so you can add color in.
Pick your favorite font and choose a font size.
*/
@import url('https://fonts.googleapis.com/css?family=Oxygen');
html, body {
font-family: "Oxygen", sans-serif;
}
[contenteditable]:focus {
outline: none;
}
.meta-on, div:hover, ul:hover, ol:hover, li:hover, p:hover, span:hover, form:hover, button:hover, input:hover, textarea:hover, img:hover {
outline: 1px solid;
animation: meta-on 3s infinite;
transition: none !important;
} @keyframes meta-on {
0% {outline-color: magenta;}
33% {outline-color: cyan;}
66% {outline-color: yellow;}
100% {outline-color: magenta;}
}
</style>
<div class="hold full hue2">
<div id="page" class="max focus gap" style="margin-top: 9%;"></div>
</div>
<script src="../../gun/gun.js"></script>
<script src="../../gun/lib/monotype.js"></script>
<script src="../../gun/lib/meta.js"></script>
<script src="../../gun/lib/normalize.js"></script>
<script async src="../../gun/lib/fun.js"></script>
<script async src="../../gun/lib/wave.js"></script>
<!-- script async src="https://edide.io/music.lib"></script -->
<script>
var gun = Gun();
var page = {};
//var gun = Gun(['https://guntest.herokuapp.com/gun', 'http://localhost:8765/gun']);
;(window.onhashchange = function(){
var file = (location.hash||'').slice(1);
var S = +new Date;
$('#page').empty().attr('contenteditable', 'false');
gun.get('test/gun/docs/'+file).get('what').map().on(function render(data, i, msg, eve){
var tmp = page[i] || '';
var last = Gun.state.is(gun._.root.graph[msg.put['#']], i);
if(last < tmp.last){ return }
//});
//if(window.LOCK){ return }
var p = $('#page').children().get(i);
if(!p){
$('#page').append('<p>');
setTimeout(function(){ render(data, i, msg, eve) },0);
return;
}
var DBG = {s: +new Date};
var r = monotype(p);
DBG.mono = +new Date;
var safe = $.normalize(data);
DBG.norm = +new Date;
p.outerHTML = data;
DBG.html = +new Date;
r.restore();
DBG.rest = +new Date;
//console.log("mono:", DBG.mono - DBG.s, "norm:", DBG.norm - DBG.mono, 'html:', DBG.html - DBG.norm, 'rest:', DBG.rest - DBG.html, ':::', msg, eve);
});
})();
window.requestAnimationFrame = window.requestAnimationFrame || setTimeout;
window.requestAnimationFrame(function frame(){
window.requestAnimationFrame(frame, 16);
}, 16);
document.execCommand('defaultParagraphSeparator', false, 'p');
meta.edit({
name: "Edit",
combo: ['E'],
use: function(eve){
console.log('on');
}, on: function(eve){
if($(eve.target).closest('p').length){ return }
var edit = this;
setTimeout(function(){ meta.flip(false) },1);
edit.init();
$(document).on('keydown.tmp', '[contenteditable]', function(eve){
if(eve.which != 13){ return }
eve.preventDefault();
var r = window.getSelection().getRangeAt(0);
var c = r.commonAncestorContainer, p;
r.deleteContents();
var p = c.splitText? $(c.splitText(r.startOffset)).parent() : $(c);
var n = $("<"+p.get(0).tagName+">"), f;
p.contents().each(function(){
if(this === c){ return f = true }
if(!f){ return }
n.append(this);
});
p.after(n);
edit.select(n.get(0));
// make sure we re-save & sync each changed paragraph.
edit.save(p);
p.nextAll().each(function(){
edit.save(this);
});
}).on('keyup.tmp', '[contenteditable]', function(eve){
//$('#debug').val(doc.html());
var p = $(window.getSelection().anchorNode).closest('p'), tmp;
(tmp = page[p.index()] || (page[p.index()] = {})).last = (+new Date) + 99;
clearTimeout(tmp.to); tmp.to = setTimeout(function(){
var DBG = {s: +new Date};
var r = monotype(p);
DBG.m = +new Date;
var html = p.html() || '';
DBG.g = +new Date;
if(!html && !p.prev().length && !p.next().length && !$('#page').html()){
edit.init();
}
DBG.i = +new Date;
var safe = $.normalize(html);
DBG.n = +new Date;
p.html(safe);
DBG.h = +new Date;
r.restore();
DBG.r = +new Date;
edit.save(p);
DBG.p = +new Date;
//console.log("save:", DBG.p - DBG.r, "rest:", DBG.r - DBG.h, "html:", DBG.h - DBG.n, "norm:", DBG.n - DBG.i, 'init:', DBG.i - DBG.g, 'grab:', DBG.g - DBG.m, 'mono:', DBG.m - DBG.s);
},50)});
},
up: function(){
console.log("UP");
$('[contenteditable=true]').off('.tmp');
},
init: function(){
var edit = this;
var doc = $('#page').attr('contenteditable', 'true');
if(!doc.text()){
doc.html('<p class="loud crack"></p>');
}
edit.select(doc.children().first().get(0));
},
save: function(p){
p = $(p);
var i = p.index();// = Array.prototype.indexOf.call(parent.children, child);
var file = (location.hash||'').slice(1);
var data = (p.get(0)||{}).outerHTML||'';
//data = $.normalize(data); // GOOD TO DO SECURITY ON SENDING SIDE TOO!!!
window.LOCK = true;
gun.get('test/gun/docs/'+file).get('what').get(i).put(data);
window.LOCK = false;
},
select: function(p){
var s = window.getSelection(),
r = document.createRange();
if(p.innerHTML){
r.setStart(p, 0);
r.collapse(true);
s.removeAllRanges();
s.addRange(r);
return;
}
p.innerHTML = '\u00a0';
r.selectNodeContents(p);
s.removeAllRanges();
s.addRange(r);
document.execCommand('delete', false, null);
}
});
;(function(){
meta.edit({name: "Design", combo: ['D']});
meta.edit({name: "Fill", combo: ['D','F'], // TODO!
use: function(eve){},
on: function(eve){
var on = meta.tap();
meta.ask('Color name, code, or URL?', function(color){
on.css('background', color);
}, true);
},
up: function(eve){}
});
meta.edit({name: "Add", combo: ['D','A']});
meta.edit({name: "Row", combo: ['D','A', 'R'],
on: function(eve){
meta.tap().append('<div style="min-height: 9em; padding: 2%;">');
}
});
meta.edit({name: "Columns", combo: ['D','A','C'],
on: function(eve){
var on = meta.tap().addClass('center'), tmp, c;
var html = '<div class="unit col" style="min-height: 9em; padding: 2%;"></div>';
if(!on.children('.col').length){ html += html }
c = (tmp = on.append(html).children('.col')).length;
tmp.each(function(){
$(this).css('width', (100/c)+'%');
})
}
});
meta.edit({name: "Text", combo: ['D','A','T'],
on: function(eve){
var tag = $('<p>text</p>');
meta.tap().append(tag);
tag.focus();
}
});
meta.edit({name: "Delete", combo: ['D','A','D'],
on: function(eve){
meta.tap().remove();
}
});
meta.edit({name: "Turn", combo: ['D','T']});
meta.edit({name: "Size", combo: ['D','S']});
meta.edit({name: "X", combo: ['D','S','X'],
on: function(eve){
var on = this.a = meta.tap().addClass('meta-on'), was = on.width();
$(document).on('mousemove.tmp', function(eve){
var be = was + ((eve.pageX||0) - was);
on.css({'max-width': be, width: '100%'});
});
meta.ask('Width in px, %, or other unit?', function(w){
if(!w){ return }
on.css({'max-width': w, width: '100%'});
}, true);
}, up: function(){
$(document).off('mousemove.tmp');
this.a.removeClass('meta-on');
}
});
meta.edit({name: "Y", combo: ['D','S','Y'],
//on: function(eve){ console.log('on Y') },
on: function(eve){ console.log('use Y')
var on = this.a = meta.tap().addClass('meta-on'), was = on.height();
$(document).on('mousemove.tmp', function(eve){
var be = was + ((eve.pageY||0) - was);
on.css({'min-height': be});
})
}, up: function(){ console.log('up Y')
$(document).off('mousemove.tmp');
this.a.removeClass('meta-on');
}
});
}());
;(function(){
var logic = {};
meta.edit({name: "Logic", combo: ['L']});
meta.edit({name: "Symbol", combo: ['L','S'],
on: function(eve){
console.log(1);
}
});
meta.edit({name: "Action", combo: ['L','A'],
on: function(eve){
console.log(2);
}
});
meta.edit({name: "Data", combo: ['L','D'],
on: function(eve){
console.log(3);
}
});
}());
;(function(){
var song = {};
// TODO:
// 1. Manually OR automatically load music.js API, dependencies, and modules. - FINE for now
// 2. only export music API, not meta, not dom, not mouselock system, not UI/html, etc. better module isolation and export.
// 3. `var wave = Wave('a').play()` // also on `Music.now`
// defaults... instrument: pure tones, volume curve: |\_ , speed curve: 0.5
// 4. `wave.blur(0.5).itch(0.5);`
// 5. wave.long(2); // how long in seconds each note plays, optionally: wave.pace(60) is bpm
// 6. wave.loud(0.5); // 0% to 100% volume loudness of device output.
// 7. wave.vary(0.5); // slows down or speeds up wiggle per harmonic
// 8:
// wave structure, does ToneJS allow us to change the sine wave smoothness/type continuously or is it a pre-fixed type?
// wave structure: /\/\/, |_|, /|/, \|\| do some research with ToneJS whether these are dynamic or fixed
// wave.itch(); // changes the shape of the wiggle from smooth sine to square or triangle
// wave.blur(220hz); // blur may not apply/work on pure notes other than filtering them.
meta.edit({name: "Music", combo: ['M']});
meta.edit({name: "Play", combo: ['M','P'],
on: function(eve){
// TODO: We still need to add to meta API ability to change name.
if(song.play){
music.stop();
song.play = false;
return;
}
song.play = true;
music.stop();
setTimeout(function(){
song.now = wave($('#page').text()).play();
},250);
}
});
meta.edit({name: "Blur", combo: ['M','B'],
on: function(eve){
$(document).on('mousemove.tmp', function(eve){
var x = eve.pageX;
song.now.loud(x/$('body').innerWidth());
});
},
up: function(){
$(document).off('.tmp');
}
});
$(document).on('keydown', function(eve){
if(eve.which === music.which){ return }
music.play(String.fromCharCode(music.which = eve.which));
});
}());
;(function(){
/*
Edit
Bold
Italic
Link
?
Left
Middle
Right
Justify
?
Small
Normal
Header
Title
Design
Add
Row
Column
Text
Delete
Turn
Grab
Size
X
Y
Fill
Logic
Symbol
Action
Data
*/
/*
*/
}());
</script>
</body>
</html>
================================================
FILE: examples/express.js
================================================
console.log("If module not found, install express globally `npm i express -g`!");
var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765;
var express = require('express');
var Gun = require('..');
require('../axe');
var app = express();
app.use(Gun.serve);
app.use(express.static(__dirname));
var server = app.listen(port);
var gun = Gun({ file: 'data', web: server });
global.Gun = Gun; /// make global to `node --inspect` - debug only
global.gun = gun; /// make global to `node --inspect` - debug only
console.log('Server started on port ' + port + ' with /gun');
================================================
FILE: examples/game/furball.html
================================================
<!DOCTYPE html>
<html>
<head>
<!-- always start with these two lines to set a clean baseline for different devices -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<!-- link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/gun/examples/style.css" -->
<script src="https://cdn.jsdelivr.net/npm/gun/examples/jquery.js"></script>
<title>Furball</title>
</head>
<body class="black whitet">
<style>
/*
Choose white text on a black background so you can add color in.
Pick your favorite font and choose a font size.
*/
@import url('https://fonts.googleapis.com/css?family=Mali');
html, body {
font-family: "Mali", sans-serif;
}
.huef {
background: #4D79D8;
-webkit-animation: huef 9s infinite;
animation: huef 9s infinite;
} @keyframes huef {
0% {background-color: #4D79D8;}
25% {background-color: #33cc33;}
50% {background-color: #f2b919;}
75% {background-color: #ea3224;}
100% {background-color: #4D79D8;}
} @-webkit-keyframes huef {
0% {background-color: #4D79D8;}
25% {background-color: #33cc33;}
50% {background-color: #f2b919;}
75% {background-color: #ea3224;}
100% {background-color: #4D79D8;}
}
button, input {
padding: 1em;
background: transparent;
border: 1px solid white;
border-radius: 1.5em;
color: white;
margin: 0.5em;
margin-bottom: 0;
cursor: pointer;
}
button:hover, input:hover {
background: white;
color: black;
transform: scale(1.1);
}
.air { padding-top: 9%; }
.yak button { font-size: 80%; }
.wag {
-webkit-animation: wag 3s infinite;
animation: wag 3s infinite;
} @keyframes wag {
0% {transform: rotate(0deg);}
50% {transform: rotate(-1deg);}
100% {transform: rotate(0deg);}
}
@keyframes print {
0% { overflow: hidden; height: 0vh; }
99% { overflow: hidden; height: 100vh; }
100% { overflow: visible; height: auto; }
}
input {
outline: none;
}
</style>
</style>
<!-- for educational sites, consider starting with a nice full screen welcome message -->
<div class="home hold full huef center air">
<div class="focus row">
<p><i>Neon ERA presents</i></p>
<p class="shout wag">Furball Forces</p>
<!-- just like in real life, say who you are and give a concise reason why you add value to someone's life and then make a call to action, if they want to learn more they can always scroll to learn more -->
<div>
<!-- a class="unit hold" href="#fullscreen"><button>WATCH TRAILER</button></a -->
<a class="unit yak" href="#choose"><button>PLAY GAME</button></a>
</div>
</div>
<div class="focus center row leak">
<!-- just like in real life, looking pretty attracts attention, so show off and look glamorous! -->
<img class="unit blink" src="file:///Users/mark/Pictures/supercatdog.png" style="min-width: 10em; width: 80%;">
</div>
<script>location.hash = ''</script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/fun.js"></script>
<script>;(function(){
// OPTIONAL MUSIC:
$('.home button').on('click', function(){
if(window.screen.height > window.screen.width){ return }
$('body').append("<div id='audio' onclick='$(this).remove();'><iframe width='0' height='0' src='https://www.youtube-nocookie.com/embed/LLPoZGX0qZk?autoplay=1' frameborder='0'></iframe></div>");
})
}());
</script>
<style>#audio { padding: 0.5em; position: fixed; bottom: 0; left: 0; } #audio:before { content: '\25BA'; } #audio:hover:before { content: '\25FC'; }</style>
</div>
<div id="choose" class="hold full hue4 center air">
<div class="focus row">
<p class="shout wag fur">Choose Team:</p>
<div>
<a class="unit yak" href="#automecha"><button style="background: white; color: black;">#AutoMecha</button></a>
<a class="unit yak" href="#cyberninjas"><button style="background: black; color: white; border-color: black;">#CyberNinjas</button></a>
</div>
</div>
<div class="focus center row leak">
<img class="unit blink" src="file:///Users/mark/Pictures/supercatdog.png" style="transform: scaleX(-1); filter: invert(1); min-width: 10em; width: 80%;">
</div>
</div>
<div id="cyberninjas" class="hold full black">
<style>
#cyberninjas:target .story {
animation: print 3s steps(50, end);
}
</style>
<div class="story pad">
<p class="loud crack">Episode 1: Waking</p>
<p>"How long until they're online?"</p>
<p>"We're copying the soul files, almost done."</p>
<p>"Monsters are on the bridge, we do not have time!"</p>
<p>"The new body is printing now, it'll be able to outrun them all, just hold on."</p>
<p>"It won't know where to run! We're risking ruining the whole resistance, I need to talk to it now."</p>
<p>"95% done." The voice behind the glass turns to the soul in the body, "My cub, can you hear me?"</p>
<p>...</p>
<a class="unit yak" href="#cyberninjas2"><button>Reply "Yes, Mom?"</button></a>
</div>
<script>
;(function(){
$('#cyberninjas a').on('click', function(){
$('#hud .life').removeClass('down');
});
}());
</script>
</div>
<div id="cyberninjas2" class="hold full red">
<style>
#cyberninjas2:target .story {
animation: print 3s steps(50, end);
}
#hud {
opacity: 0.4;
font-family: 'Audiowide', cursive;
z-index: 999999999999;
transition: all 3s;
}
#hud .life {
position: fixed;
left: 50%;
bottom: 0px;
padding: 0.25em 1em 0.1em;
border-radius: 0.5em 0.5em 0 0;
transform: translateX(-50%);
background: black;
text-shadow: 0em -0.125em 0.75em white;
}
#hud .score {
position: fixed;
left: 50%;
top: 0px;
padding: 0.1em 1em 0.25em;
border-radius: 0 0 0.5em 0.5em;
transform: translateX(-50%);
background: black;
text-shadow: 0em 0.1em 0.75em white;
}
#hud .down {
bottom: -2em !important;
}
#hud .up {
top: -2em !important;
}
</style>
<div id="hud">
<div class="score shade up">
SCORE: <span id="hudscore">0</span>%
</div>
<div class="life shade down">
LIFE: <span id="hudlife">50</span>%
</div>
</div>
<div class="story pad">
<p>A fire explodes in the room behind the glass as an AutoMecha blows the door open.</p>
<p>The floor shakes and the bed crashes through the wall, flying out of the building.</p>
<p class="center">"Mom!!!"</p>
<p>There is a total free fall from 10 levels up, water down below.</p>
<p>...</p>
<a class="unit yak" href="#cyberninjas3"><button>Dive or Die</button></a>
</div>
<script>
;(function(){
$('#cyberninjas2 a').on('click', function(){
$('#hudlife').text($('#hudlife').data().is = 50);
});
}());
</script>
</div>
<div id="cyberninjas3" class="hold full blue">
<style>
@import url('https://fonts.googleapis.com/css?family=Audiowide');
#cyberninjas3:target .story {
animation: print 3s steps(50, end);
}
</style>
<div class="story pad">
<p>The water splashes, swelling and swirling all around.</p>
<p>...</p>
<p class="center">Rapidly tap to swim up to air:</p>
<a class="unit yak"><button>Swim</button></a>
</div>
<script>
;(function(){
var go, life = $('#hudlife').data();
$('#cyberninjas3 a').on('click', function(){
$('#hudlife').text(life.is += 5);
if(100 <= life.is){
location.hash = 'cyberninjas4';
clearInterval(go);
go = false;
return;
}
if(go){ return }
go = setInterval(function(){
if(0 >= life.is){
location.hash = 'cyberninjas2';
$('#hudlife').text(life.is = 50);
clearInterval(go);
go = false;
return;
}
$('#hudlife').text(life.is -= 5);
}, 1000); // 1 second
});
}());
</script>
</div>
<div id="cyberninjas4" class="hold full black">
<style>
#cyberninjas4:target .story {
animation: print 3s steps(50, end);
}
</style>
<div class="story pad">
<p class="loud crack">Episode 2: Who Am I?</p>
<p>"Grab on!" A voice calls out from the darkness.</p>
<p>A life vest hits the water and floats within arm's distance.</p>
<p>The shivering body is pulled up onto the boat.</p>
<p>"Wow, you're heavier than you look. Are you OK? What's your name?"</p>
<p>...</p>
<p class="center">Write your reply & hit enter:</p>
<form class="center">
<input class="loud" style="width: 60%;">
</form>
</div>
<script>
;(function(){
$('form').on('submit', function(eve){ eve.preventDefault() });
$('#cyberninjas4').on('submit', function(){
var name = $(this).find('input').val();
if(!name.length){ return }
$('.story-name').text(' '+(window.NAME = name));
$('#hud .score').removeClass('up');
location.hash = 'cyberninjas5';
})
}());
</script>
</div>
<div id="cyberninjas5" class="hold full green">
<style>
#cyberninjas5:target .story {
animation: print 3s steps(50, end);
}
</style>
<div class="story pad">
<p>"Well<span class="story-name"></span>, it's a miracle you did not die in the building explosion or from that fall."</p>
<p>"What is going on? What happened?"</p>
<p>"You can't remember? Your brain must be knocked up pretty hard."</p>
<p>"No, I was mid copy into this body and now my memories are glitching."</p>
<p>"Woah, you're one of those pro elite AREION revolutionaries? All flesh & blood! Dense, too. I would've assumed they were stealing AutoMecha tech for that instead."</p>
<p>"I was about to be told vital data for the resistance, but then they blew up the build--"</p>
<p>...</p>
<p>"Hey, what's the matter?"</p>
<p>"My mom. She was in there. I need to go back. Please, help me and tell me everything you know."</p>
<p>"I'm so sorry. I can only get so close with the boat, you're gonna have to jump over a lot of broken bits. You ready?"</p>
<p>...</p>
<a class="unit yak" href="#cyberninjas6"><button>GO!</button></a>
</div>
</div>
<div id="cyberninjas6" class="hold full green">
<style>
#cyberninjas6:target .story {
animation: print 3s steps(50, end);
}
</style>
<div class="story pad">
<p class="center">... to be continued ...</p>
<div id="player" style="position: fixed; width: 1em; height: 1em; background: white; left: 50%; top: 50%; border-radius: 100%;"></div>
<!-- jumping game ? like offline dinosaur ? -->
</div>
<script src="../../../gun/lib/meta.js"></script>
<script>
;(function(){
var p = $('#player');
p.x = 50;
p.y = 50;
meta.edit({
name: "Up",
combo: ["W"],
on: function(){
console.log("up");
this.to = this.to || setInterval(this.on, 100);
$("html, body").stop().animate({ scrollTop: $(window).scrollTop()-100 }, 100);
p.css({top: --p.y +'%'});
},
use: function(){},
up: function(){ clearTimeout(this.to); this.to = 0 }
});
meta.edit({
name: "Left",
combo: ["A"],
on: function(){
console.log("left");
this.to = this.to || setInterval(this.on, 100);
p.css({left: --p.x +'%'});
},
use: function(){},
up: function(){ clearTimeout(this.to); this.to = 0 }
});
meta.edit({
name: "Down",
combo: ["S"],
on: function on(){
console.log("down");
this.to = this.to || setInterval(this.on, 100);
$("html, body").stop().animate({ scrollTop: $(window).scrollTop()+100 }, 100);
p.css({top: ++p.y +'%'});
},
use: function(){},
up: function(){ clearTimeout(this.to); this.to = 0 }
});
meta.edit({
name: "Right",
combo: ["D"],
on: function(){
console.log("right");
this.to = this.to || setInterval(this.on, 100);
p.css({left: ++p.x +'%'});
},
use: function(){},
up: function(){ clearTimeout(this.to); this.to = 0 }
});
meta.edit({
name: "Jump",
combo: [32],
on: function(){ console.log("jump") },
use: function(){},
up: function(){}
});
meta.edit({
name: "Crouch",
combo: [16],
on: function(){ console.log("crouch") },
use: function(){},
up: function(){}
});
meta.edit({
name: "Use",
combo: ["E"],
on: function(){ console.log("use") },
use: function(){},
up: function(){}
});
meta.edit({
name: "Fire",
combo: ["F"],
on: function(){ console.log("fire") },
use: function(){},
up: function(){}
});
meta.edit({
name: "Switch",
combo: [9],
on: function(){ console.log("Switch") },
use: function(){},
up: function(){}
});
window.requestAnimationFrame = window.requestAnimationFrame || setTimeout;
window.requestAnimationFrame(function frame(){
window.requestAnimationFrame(frame, 16);
}, 16);
}());
</script>
</div>
<div id="automecha" class="hold full white blackt">
<style>
#automecha:target .story {
animation: print 3s steps(50, end);
}
</style>
<div class="story pad">
<p class="loud crack">Episode 1: Training</p>
<p>...</p>
</div>
</div>
<div class="hold black center">
<div class="pad">
<div class="left">
<p class="loud">For <i>You</i>,</p>
<p>Crafted with love, <span class="redt">♥</span> by ERA.</p>
</div>
</div>
<div>
<img src="https://era.eco/media/world.png" class="row">
</div>
</div>
</body>
</html>
================================================
FILE: examples/game/nts.html
================================================
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body style="text-align: center;">
<h1 id="when" style="font-size: 7vw; margin-top: 43vh; font-family: monospace;"></h1>
</body>
<script src="/gun.js"></script>
<script src="/gun/nts.js"></script>
<script>
window.gun = Gun(location.origin+'/gun');
requestAnimationFrame(function now(){
requestAnimationFrame(now);
var time = new Date(Gun.state());
var print = time.toLocaleString() +' '+ (time.getMilliseconds()/1000).toFixed(3).slice(1);
when.innerHTML = print;
});
</script>
</html>
================================================
FILE: examples/game/space.html
================================================
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<div id="area">
<div id="me" class="ship">
<div class="laser"></div>
</div>
</div>
<p id="debug" style="position: fixed; bottom: 0px; color: white; height: 1em;"></p>
<script src="../jquery.js"></script>
<script src="../../../gun/gun.js"></script>
<!-- script src="../../../gun/nts.js"></script -->
<script src="../../../gun/lib/webrtc.js"></script>
<script>
// Thanks to https://github.com/dmcinnes/HTML5-Asteroids
//var gun = Gun();
var gun = GUN(location.origin + '/gun');
var game = {gun: gun.get('example/game/space'), area: {}, ships: {}};
game.keys = {38: 'up', 37: 'left', 39: 'right', 40: 'down', 32: 'space'};
$(document).on('keydown', function(e){
//e.preventDefault();
var key = e.keyCode, me;
game.keys[key = game.keys[key]] = true;
if(!(me = game.me)){ return }
me.last = game.now;
if('space' === key){ game.shoot(game.me) }
});
$(document).on('keyup', function(e){
//e.preventDefault();
game.sync();
game.keys[game.keys[e.keyCode]] = false;
});
game.shoot = function(ship, when){
if(!ship || ship.l){ return }
if(!when && ship.gun && ship.data){
ship.data.l = game.now;
game.sync(true);
return;
}
if(when + 250 < game.now){ return }
ship.l = true;
ship.$.children('.laser').show();
setTimeout(function(){
ship.$.children('.laser').hide();
setTimeout(function(){
ship.l = false;
}, 250);
}, 250 - (game.now - when));
}
game.ship = function(d, el){
if(!d){ // spawn our ship
var id = String.random(1, 'abcdefghijklmno');
game.me = game.ships[id] = {data: d = {id: id, t: game.now}};
game.me.gun = game.gun.get('players').get(d.id).put(d);
return;
}
if(!d.id){ return }
if(!game.ships[d.id]){
game.ships[d.id] = {};
}
var s = game.ships[d.id];
s.t = d.t || (d.t = 0);
s.x = d.x || (d.x = game.area.x * Math.random());
s.y = d.y || (d.y = game.area.y * Math.random());
s.r = d.r || (d.r = 0);
s.vx = d.vx || (d.vx = 0);
s.vy = d.vy || (d.vy = 0);
s.vr = d.vr || (d.vr = 0);
s.ax = s.ax || 0;
s.ay = s.ay || 0;
s.ar = s.ar || 0;
s.data = d;
s.$ = s.$ || (s.gun? ($('#me'))
: $('#me').clone(true).attr('id', d.id).appendTo('#area'));
if(!s.l){
game.shoot(s, d.l);
}
s.frame = s.frame || function(t, now){
if(s.gun){
s.fly(t, now);
}
if(s.calc(t, now)){ return }
s.draw();
}
var keys = game.keys;
var area = game.area;
s.fly = s.fly || function(t, now){
if(keys.left){
s.r += -6;
} else
if(keys.right) {
s.r += 6;
}
if(keys.up){
var rad = ((s.r - 90) * Math.PI)/180;
s.ax = 0.0001 * Math.cos(rad);
s.ay = 0.0001 * Math.sin(rad);
} else {
s.ax = 0;
s.ay = 0;
}
Object.keys(game.ships).forEach(function(key, ship){
ship = game.ships[key];
if(ship.gun){ return }
if(!ship.l){ return }
if(ship.x-50 <= s.x && s.x <= ship.x+50
&& ship.y-50 <= s.y && s.y <= ship.y+50){
s.data.t = -1;
game.sync(true);
s.boom = true;
}
});
s.vx += s.ax * t;
s.x += s.vx * t;
s.vy += s.ay * t;
s.y += s.vy * t;
var data = s.data;
if(!data){ return }
data.r = s.r;
data.vx = s.vx;
data.x = s.x;
data.vy = s.vy;
data.y = s.y;
if(data.t < 0){ return }
data.t = now;
s.t = data.t;
}
s.calc = s.calc || function(t, now){
var d = s.data;
var dt = (now - d.t) || 0;
if(dt > 30 * 1000){
delete game.ships[d.id];
s.$.remove();
return true;
}
if(!d){ return }
var speed = Math.sqrt(d.vx * d.vx + d.vy * d.vy);
if(speed > 0.15){
s.vy = d.vy = d.vy / speed * 0.15;
s.vx = d.vx = d.vx / speed * 0.15;
}
s.x = d.x + d.vx * dt;
s.y = d.y + d.vy * dt;
s.x = s.x % area.x;
if(s.x < 0){
s.x += area.x;
}
s.y = s.y % area.y;
if(s.y < 0){
s.y += area.y;
}
}
s.draw = s.draw || function(){
s.css = 'rotate('+s.r+'deg)';
s.$.css({left: s.x, top: s.y, transform: s.css});
}
return s;
}
game.sync = function(shoot){
var me = game.me;
if(!me || me.boom){ return }
var keys = game.keys;
if(shoot || keys.up || keys.right || keys.left || keys.down){
var data = {};
Object.keys(me.data).forEach(function(k){ data[k] = me.data[k] }); // 1 layer clone.
data.x = data.x / game.area.x;
data.y = data.y / game.area.y;
me.gun.put(data);
}
}
game.frame = window.requestAnimationFrame || setTimeout;
game.resize = function(){
game.area.x = $('#area').innerWidth();
game.area.y = $('#area').innerHeight();
}
$(window).on('resize', game.resize);
game.start = function(){
game.now = Gun.state();
game.resize();
game.ship();
game.gun.get('players').map().on(function(data, id){
data = JSON.parse(JSON.stringify(data)); // clone object, this is bad perf tho.
data.x = data.x * game.area.x;
data.y = data.y * game.area.y;
data.id = data.id || id;
game.ship(data);
});
var frame = game.frame, ships = game.ships;
var last = game.now, now, diff, delta;
setInterval(game.sync, 99);
frame(function next(t){
frame(next, 1000/60);
now = game.now = Gun.state();
diff = now - last;
last = now;
Object.keys(ships).forEach(function(key, ship){
ship = ships[key];
if(!ship.frame){ return }
ship.frame(diff, now);
});
}, 1000/60);
}
$(function(){
game.start();
});
// test WebRTC
gun.on('hi', function(peer){
console.log("hi!", peer);
if(peer.url){ return }
var peers = gun.back('opt.peers');
Object.keys(peers).forEach(function(id, peer){
peer = peers[id];
if(!peer.url || !peer.wire){ return }
peer.wire._send = peer.wire.send;
peer.wire.send = send;
var tmp = 'GOBBLE GOBBLE: Not sending any non-WebRTC messages to ' + peer.url;
console.log(tmp);
$('#debug').text(tmp);
});
});
function send(raw){
if(!raw){ return }
if(raw.indexOf('rtc') >= 0){
if(!this._send){ return }
return this._send(raw);
}
}
</script>
<style>
html, body {
margin: 0;
padding: 0;
background: #111;
}
html, body, div {
position: relative;
}
#area {
width: 95%;
width: 1024px;
height: 768px;
margin: 0 auto;
background: black;
overflow: hidden;
}
.ship {
position: absolute;
width: 0px;
height: 0px;
border-left: 5px solid transparent;
border-right: 5px solid transparent;
border-bottom: 15px solid red;
transform-origin: 50% 50%;
color: white;
}
#me {
border-bottom: 15px solid limegreen;
}
.boom {
border: 1vmax dotted yellow;
border-bottom: 1vmax dotted yellow;
height: 5vmax;
width: 1vmax;
}
.laser {
display: none;
position: relative;
background: transparent;
border: 2px dotted yellow;
height: 100px;
width: 100px;
top: -50px;
left: -50px;
}
</style>
</html>
================================================
FILE: examples/game/win.html
================================================
<!DOCTYPE html>
<html>
<head>
<!-- always start with these two lines to set a clean baseline for different devices -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="../style.css">
<!-- link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/gun/examples/style.css" -->
<script src="https://cdn.jsdelivr.net/npm/gun/examples/jquery.js"></script>
<title>Win</title>
</head>
<body class="black whitet">
<style>
/*
Choose white text on a black background so you can add color in.
Pick your favorite font and choose a font size.
*/
@import url('https://fonts.googleapis.com/css?family=Montserrat');
html, body {
font-family: "Montserrat", sans-serif;
}
button, input {
padding: 1em;
background: transparent;
border: 1px solid white;
border-radius: 1.5em;
color: white;
margin: 0.5em;
margin-bottom: 0;
cursor: pointer;
}
button:hover, input:hover {
background: white;
color: black;
transform: scale(1.1);
}
.air { padding-top: 9%; }
.yak button { font-size: 80%; }
.wag {
-webkit-animation: wag 3s infinite;
animation: wag 3s infinite;
} @keyframes wag {
0% {transform: rotate(0deg);}
50% {transform: rotate(-1deg);}
100% {transform: rotate(0deg);}
}
</style>
</style>
<!-- for educational sites, consider starting with a nice full screen welcome message -->
<div class="home hold full huef center air">
<div class="focus row">
<p><i>how to</i></p>
<p class="shout wag">Win at Life!</p>
<p><i>success, fame, power.</i></p>
<p><i>sex, ethics, & integrity.</i></p>
<!-- just like in real life, say who you are and give a concise reason why you add value to someone's life and then make a call to action, if they want to learn more they can always scroll to learn more -->
<div>
<!-- a class="unit hold" href="#fullscreen"><button>WATCH TRAILER</button></a -->
<a class="unit yak gap" href="#breathe"><button>PLAY GAME</button></a>
</div>
</div>
<div class="focus center row leak">
<!-- just like in real life, looking pretty attracts attention, so show off and look glamorous! -->
<img class="unit blink" src="" style="min-width: 10em; width: 80%;">
</div>
<script>location.hash = ''</script>
<script src="https://cdn.jsdelivr.net/npm/gun/lib/fun.js"></script>
</div>
<div id="breathe" class="hold full green">
<style>
</style>
<div class="story pad">
<p class="loud crack">Step 1: Breathe</p>
<a class="unit yak" href="#water"><button>Yupe</button></a>
</div>
<script>
</script>
</div>
<div id="water" class="hold full blue">
<style>
</style>
<div class="story pad">
<p class="loud crack">Step 2: Drink Water</p>
<p></p>
<a class="unit yak" href="#eat"><button>Next</button></a>
</div>
<script>
</script>
</div>
<div id="eat" class="hold full red">
<style>
</style>
<div class="story pad">
<p class="loud crack">Step 3: Eat Once a Day</p>
<p>If you do not want to be eaten, do not eat things that would not want to be eaten.</p>
<a class="unit yak" href="#babies"><button>Got It</button></a>
</div>
<script>
</script>
</div>
<div id="babies" class="hold full red">
<style>
</style>
<div class="story pad">
<p class="loud crack">Step 4: Babymaking* 😉</p>
<p>Find a willing player.</p>
<p><small> * This does not always make babies.</small></p>
<a class="unit yak" href="#make"><button>How?</button></a>
</div>
<script>
</script>
</div>
<div id="make" class="hold full hue">
<style>
</style>
<div class="story pad">
<p class="loud crack">Step 5: Make Dance</p>
<p>Moving your body is how you express your thoughts.</p>
<p>What you do with your body is what others will come to know you for. So do well.</p>
<p>You can make art, songs, or stories; You can make science, tools, or discoveries.</p>
<p>Who are you?</p>
<a class="unit yak" href="#science"><button>I am a Scientist!</button></a>
<a class="unit yak" href="#art"><button>I am an Artist!</button></a>
</div>
<script>
</script>
</div>
<div id="science" class="hold full hue">
<div class="story pad">
<p class="loud crack">Science: Knowing Games</p>
<p>If you must win one game, it should be the game of making games.</p>
<p>If you can make any game, then you will know how to win any game.</p>
<a class="unit yak" href="#games"><button>Games?</button></a>
</div>
<script>
</script>
</div>
<div id="games" class="hold full hue">
<div class="story pad">
<p>Games have goals and play.</p>
<p>Play is a safe space to try new dances.</p>
<p>Goals try to get players to do a type of dance.</p>
<a class="unit yak" href="#swim"><button>Start</button></a>
</div>
<script>
</script>
</div>
<div id="swim" class="hold full blue">
<style>
@import url('https://fonts.googleapis.com/css?family=Audiowide');
#hud {
opacity: 0.4;
font-family: 'Audiowide', cursive;
z-index: 999999999999;
transition: all 3s;
}
#hud .life {
position: fixed;
left: 50%;
bottom: 0px;
padding: 0.25em 1em 0.1em;
border-radius: 0.5em 0.5em 0 0;
transform: translateX(-50%);
background: black;
text-shadow: 0em -0.125em 0.75em white;
}
#hud .score {
position: fixed;
left: 50%;
top: 0px;
padding: 0.1em 1em 0.25em;
border-radius: 0 0 0.5em 0.5em;
transform: translateX(-50%);
background: black;
text-shadow: 0em 0.1em 0.75em white;
}
#hud .down {
bottom: -2em !important;
}
#hud .up {
top: -2em !important;
}
</style>
<div class="story pad">
<p>The simplest goal is to not "die" in the game.</p>
<p>Oh look, you've fallen into water and cannot breathe.</p>
<p>If you do not push the button to swim to the top, you'll lose the game.</p>
<a class="unit yak"><button>Swim</button></a>
</div>
<div id="hud">
<div class="score shade up">
SCORE: <span id="hudscore">0</span>%
</div>
<div class="life shade down">
LIFE: <span id="hudlife">100</span>%
</div>
</div>
<script>
;(function(){
var go, life = $('#hudlife').data();
$(window).on('hashchange', function(){
if(location.hash != '#swim'){ return }
$('#hudlife').text($('#hudlife').data().is = 100);
$('#hud .life').removeClass('down');
go = setInterval(function(){
if(0 >= life.is){
location.hash = 'die';
clearInterval(go);
go = false;
return;
}
$('#hudlife').text(life.is -= 1);
}, 100);
})
$('#swim a').on('click', function(){
$('#hudlife').text((life.is += 5) < 100? life.is : 100);
if(100 <= life.is){
location.hash = 'won';
clearInterval(go);
go = false;
return;
}
});
}());
</script>
</div>
<div id="won" class="hold full hue">
<div class="story pad">
<p>You won your first game! 🎉</p>
<p>See? I told you breathing is important.</p>
<p>You also learned the most basic dance: rapid poking.</p>
<p>The goal of the next game is to make the game you just won.</p>
<a class="unit yak" href="#won" style="z-index: 999999;"><button>Make</button></a>
</div>
<script src="https://cdn.jsdelivr.net/gh/amark/gun/lib/meta.js"></script>
<script>
meta.edit({name: "Add", combo: ['A']});
meta.edit({
name: "Timer",
combo: ['A','T'],
on: function(){
console.log("up");
this.to = this.to || setInterval(this.on, 100);
$("html, body").stop().animate({ scrollTop: $(window).scrollTop()-100 }, 100);
p.css({top: --p.y +'%'});
},
use: function(){},
up: function(){ clearTimeout(this.to); this.to = 0 }
});
meta.edit({
name: "Delete",
combo: ['A','D'],
on: function(){
$(meta.tap.on).remove();
},
use: function(){},
up: function(){}
});
meta.edit({
name: "Button",
combo: ['A','B'],
on: function(){
$(meta.tap.on).append("<a class='unit yak'><button>Button</button></a>")
},
use: function(){},
up: function(){}
});
meta.edit({
name: "Edit",
combo: ['E'],
on: function(){
$('body').attr('contenteditable', 'true' == $('body').attr('contenteditable')? false : true);
},
use: function(){},
up: function(){ }
});
</script>
<script>
window.requestAnimationFrame(function frame(){
return;
window.requestAnimationFrame(frame);
if(location.hash != '#won'){ return }
var p = $('#won a').offset();
var bx = p.left, by = p.top, mx = meta.tap.x, my = meta.tap.y;
bx = mx - bx; by = my - by;
var d = Math.sqrt(bx*bx + by*by);
console.log(bx, by, mx, my, d);
if(d > 250){ return }
$('#won a').css({position: 'fixed', left: bx + (Math.random()*100), top: by + (Math.random()*100)});
})
</script>
</div>
<div id="rules" class="hold full white blackt">
<style>
</style>
<div class="story pad">
<p class="loud crack">Bend these Rules if it is more Moral to do so</p>
<p></p>
<a class="unit yak" href="#water"><button>Next</button></a>
</div>
<script>
</script>
</div>
<div id="die" class="hold full red">
<style>
</style>
<div class="story pad">
<p class="loud crack">GAME OVER</p>
<p></p>
<a class="unit yak" href="#make"><button>Start Over</button></a>
</div>
<script>
</script>
</div>
</body>
</html>
================================================
FILE: examples/hapi.js
================================================
console.log("If module not found, install hapi globally `npm i hapi inert -g`!")
const Hapi = require('hapi')
const Inert = require('inert')
const Gun = require('..')
const server = new Hapi.Server({
port: 8765,
host: 'localhost',
routes: {
files: {
relativeTo: require('path').join(__dirname, '..')
}
}
})
async function runtime() {
const db = new Gun({
web: server.listener,
file: 'data.json'
})
await server.register(Inert)
server.route({
method: 'GET',
path: '/gun.js',
handler: {
file: 'gun.min.js'
}
})
server.route({
method: 'GET',
path: '/gun/nts.js',
handler: {
file: 'nts.js'
}
})
server.route({
method: 'GET',
path: '/{param*}',
handler: {
directory: {
path: __dirname,
redirectToSlash: true,
index: true
}
}
})
await server.start()
console.log('Server running at:', server.info.uri)
}
runtime()
================================================
FILE: examples/http.js
================================================
;(function(){
var cluster = require('cluster');
if(cluster.isMaster){
return cluster.fork() && cluster.on('exit',function(){ cluster.fork(); require('../lib/crashed') });
}
var fs = require('fs'), env = process.env;
var GUN = require('../'); // require('gun');
var opt = {
port: env.PORT || process.argv[2] || 8765,
peers: env.PEERS && env.PEERS.split(',') || []
};
if(fs.existsSync((opt.home = require('os').homedir())+'/cert.pem')){
env.HTTPS_KEY = env.HTTPS_KEY || opt.home+'/key.pem';
env.HTTPS_CERT = env.HTTPS_CERT || opt.home+'/cert.pem';
}
if(env.HTTPS_KEY){
opt.port = 443;
opt.key = fs.readFileSync(env.HTTPS_KEY);
opt.cert = fs.readFileSync(env.HTTPS_CERT);
opt.server = require('https').createServer(opt, GUN.serve(__dirname));
require('http').createServer(function(req, res){
res.writeHead(301, {"Location": "https://"+req.headers['host']+req.url });
res.end();
}).listen(80);
} else {
opt.server = require('http').createServer(GUN.serve(__dirname));
}
var gun = GUN({web: opt.server.listen(opt.port), peers: opt.peers});
console.log('Relay peer started on port ' + opt.port + ' with /gun');
module.exports = gun;
}());
================================================
FILE: examples/https.sh
================================================
#!/bin/bash
cd ~
git clone https://github.com/acmesh-official/acme.sh.git
cd ~/acme.sh
./acme.sh --install -m $EMAIL
bash ~/acme.sh/acme.sh --issue -d $DOMAIN -w $WEB
bash ~/acme.sh/acme.sh --install-cert -d $DOMAIN --key-file ~/key.pem --fullchain-file ~/cert.pem --reloadcmd "service relay force-reload"
================================================
FILE: examples/index.html
================================================
<!DOCTYPE html>
<p>This is the examples folder.
<p>The most basic example is <a href="./basic/note.html">./basic/note.html</a>!</p>
<p>Home page temporarily disabled.</p>
================================================
FILE: examples/infinite-scroll/ScrollWindow.js
================================================
const DEFAULT_OPTIONS = {
size: 20,
stickTo: 'top',
};
class ScrollWindow {
constructor(gunNode, opts = {}) {
this.opts = Object.assign(DEFAULT_OPTIONS, opts);
this.elements = new Map();
this.node = gunNode;
this.center = this.opts.startAt;
this.updateSubscriptions();
}
updateSubscriptions() {
this.upSubscription && this.upSubscription.off();
this.downSubscription && this.downSubscription.off();
const subscribe = params => {
this.node.get({ '.': params}).map().on((val, key, a, eve) => {
if (params['-']) {
this.downSubscription = eve;
} else {
this.upSubscription = eve;
}
this._addElement(key, val);
});
};
if (this.center) {
subscribe({ '>': this.center, '<': '\uffff' });
subscribe({'<': this.center, '>' : '', '-': true});
} else {
subscribe({ '<': '\uffff', '>': '', '-': this.opts.stickTo === 'top' });
}
}
_getSortedKeys() {
this.sortedKeys = this.sortedKeys || [...this.elements.keys()].sort();
return this.sortedKeys;
}
_upOrDown(n, up) {
this.opts.stickTo = null;
const keys = this._getSortedKeys();
n = n || (keys.length / 2);
n = up ? n : -n;
const half = Math.floor(keys.length / 2);
const newMiddleIndex = Math.max(Math.min(half + n, keys.length - 1), 0);
if (this.center !== keys[newMiddleIndex]) {
this.center = keys[newMiddleIndex];
this.updateSubscriptions();
}
return this.center;
}
up(n) {
return this._upOrDown(n, true);
}
down(n) {
return this._upOrDown(n, false);
}
_topOrBottom(top) {
this.opts.stickTo = top ? 'top' : 'bottom';
this.center = null;
this.updateSubscriptions();
}
top() {
this._topOrBottom(true);
}
bottom() {
this._topOrBottom(false);
}
_addElement(key, val) {
if (!val || this.elements.has(key)) return;
const add = () => {
this.elements.set(key, val);
this.sortedKeys = [...this.elements.keys()].sort();
const sortedElements = this.sortedKeys.map(k => this.elements.get(k));
this.opts.onChange && this.opts.onChange(sortedElements);
};
const keys = this._getSortedKeys();
if (keys.length < this.opts.size) {
add();
} else {
if (this.opts.stickTo === 'top' && key > keys[0]) {
this.elements.delete(keys[0]);
add();
} else if (this.opts.stickTo === 'bottom' && key < keys[keys.length - 1]) {
this.elements.delete(keys[keys.length - 1]);
add();
} else if (this.center) {
if (keys.indexOf(this.center) < (keys.length / 2)) {
if (key < keys[keys.length - 1]) {
this.elements.delete(keys[keys.length - 1]);
add();
}
} else {
if (key > keys[0]) {
delete this.elements.delete(keys[0]);
add();
}
}
}
}
}
getElements() {
return this.elements;
}
}
================================================
FILE: examples/infinite-scroll/index.html
================================================
<html>
<head>
<title>Infinite scroll example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="stylesheet" type="text/css" href="./style.css">
<script src="/jquery.js"></script>
<script src="/gun.js"></script>
<script src="./ScrollWindow.js"></script>
</head>
<body>
<header>
<form id="generate">
<input type="text" id="number" placeholder="Number of posts"/>
<button>Generate</button>
</form>
<div id="top-buttons">
<button id="top">Top</button>
</div>
</header>
<div id="top-sentinel" style="padding-top: 0px;"></div>
<div id="container"></div>
<div id="bottom-sentinel" style="padding-top: 0px;"></div>
<button id="bottom">Bottom</button>
<script src="./index.js"></script>
</body>
</html>
================================================
FILE: examples/infinite-scroll/index.js
================================================
const gun = new Gun();
const size = 20;
const gunNode = gun.get('posts');
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
let topSentinelPreviousY = 0;
let topSentinelPreviousRatio = 0;
let bottomSentinelPreviousY = 0;
let bottomSentinelPreviousRatio = 0;
let previousUpIndex = previousDownIndex = -1;
const render = elements => {
const t = new Date();
elements.reverse().forEach((data, j) => {
var date = new Date(data.date);
$('#date' + j).text(date.toLocaleDateString() + ' ' + date.toLocaleTimeString());
$('#text' + j).text(data.text);
$('#img' + j).attr('src', '');
$('#img' + j).attr('src', _getCatImg(date.getTime()));
$('#post' + j).css({visibility: 'visible'});
});
console.log('rendering took', new Date().getTime() - t.getTime(), 'ms');
window.onRender && window.onRender(elements);
};
const onChange = debounce(render, 20);
const scroller = new ScrollWindow(gunNode, {size, stickTo: 'top', onChange});
const initList = () => {
for (var n = 0; n < size; n++) {
var el = $("<div>").addClass('post').attr('id', 'post' + n).css({visibility: 'hidden'});
el.append($('<b>').attr('id', 'date' + n));
el.append($('<span>').attr('id', 'text' + n));
el.append($('<img>').attr('id', 'img' + n).attr('height', 100).attr('width', 100));
$('#container').append(el);
}
}
const _getCatImg = (n) => {
const url = "https://source.unsplash.com/collection/139386/100x100/?sig=";
return url + n % 999999;
};
const getNumFromStyle = numStr => Number(numStr.substring(0, numStr.length - 2));
const adjustPaddings = isScrollDown => {
const container = document.getElementById("container");
const currentPaddingTop = getNumFromStyle(container.style.paddingTop);
const currentPaddingBottom = getNumFromStyle(container.style.paddingBottom);
const remPaddingsVal = 198 * (size / 2); // TODO: calculate actual element heights
if (isScrollDown) {
container.style.paddingTop = currentPaddingTop + remPaddingsVal + "px";
container.style.paddingBottom = currentPaddingBottom === 0 ? "0px" : currentPaddingBottom - remPaddingsVal + "px";
} else {
container.style.paddingBottom = currentPaddingBottom + remPaddingsVal + "px";
if (currentPaddingTop === 0) {
$(window).scrollTop($('#post0').offset().top + remPaddingsVal);
} else {
container.style.paddingTop = currentPaddingTop - remPaddingsVal + "px";
}
}
}
const topSentCallback = entry => {
const container = document.getElementById("container");
const currentY = entry.boundingClientRect.top;
const currentRatio = entry.intersectionRatio;
const isIntersecting = entry.isIntersecting;
// conditional check for Scrolling up
if (
currentY > topSentinelPreviousY &&
isIntersecting &&
currentRatio >= topSentinelPreviousRatio &&
scroller.center !== previousUpIndex && // stop if no new results were received
scroller.opts.stickTo !== 'top'
) {
previousUpIndex = scroller.center;
adjustPaddings(false);
scroller.up(size / 2);
}
topSentinelPreviousY = currentY;
topSentinelPreviousRatio = currentRatio;
}
const botSentCallback = entry => {
const currentY = entry.boundingClientRect.top;
const currentRatio = entry.intersectionRatio;
const isIntersecting = entry.isIntersecting;
// conditional check for Scrolling down
if (
currentY < bottomSentinelPreviousY &&
currentRatio > bottomSentinelPreviousRatio &&
isIntersecting &&
scroller.center !== previousDownIndex && // stop if no new results were received
scroller.opts.stickTo !== 'bottom'
) {
previousDownIndex = scroller.center;
adjustPaddings(true);
scroller.down(size / 2);
}
bottomSentinelPreviousY = currentY;
bottomSentinelPreviousRatio = currentRatio;
}
const initIntersectionObserver = () => {
const options = {
//rootMargin: '190px',
}
const callback = entries => {
entries.forEach(entry => {
if (entry.target.id === 'post0') {
topSentCallback(entry);
} else if (entry.target.id === `post${size - 1}`) {
botSentCallback(entry);
}
});
}
var observer = new IntersectionObserver(callback, options); // TODO: It's possible to quickly scroll past the sentinels without them firing. Top and bottom sentinels should extend to page top & bottom?
observer.observe(document.querySelector("#post0"));
observer.observe(document.querySelector(`#post${size - 1}`));
}
initList(size);
initIntersectionObserver();
$('#top').click(() => {
scroller.top();
$('#container').css({'padding-top': 0, 'padding-bottom': 0});
$(document.body).animate({ scrollTop: 0 }, 500);
});
$('#bottom').click(() => {
scroller.bottom();
$('#container').css({'padding-top': 0, 'padding-bottom': 0});
$(document.body).animate({ scrollTop: $("#container").height() }, 500);
});
$('#generate').submit(e => {
e.preventDefault();
const day = 24 * 60 * 60 * 1000;
const year = 365 * day;
const n = Number($('#number').val());
for (let i = 0; i < n; i++) {
const d = new Date(40 * year + i * day).toISOString();
gunNode.get(d).put({text: 'Hello world!', date: d});
}
});
================================================
FILE: examples/infinite-scroll/style.css
================================================
html, body {
margin: 0;
padding: 0;
}
body {
padding-top: 65px;
}
header {
background: rgba(255,255,255,0.75);
padding: 15px;
}
header {
position: fixed;
top: 0; left: 0; right: 0;
}
#bottom {
position: fixed;
right: 15px;
bottom: 15px;
}
input {
border: 0;
background-color: #efefef;
padding: 15px;
border-radius: 50px;
}
button {
background-color: #4a4f9d;
border: 0;
padding: 15px;
color: white;
border-radius: 50px;
}
input, button {
outline: none;
opacity: 1;
}
input:focus, button:focus, button:hover {
opacity: 0.8;
}
button:hover {
cursor: pointer;
}
#top-buttons, form {
display: inline-block;
margin: 0;
}
#top-buttons {
float: right;
}
.post {
margin: 15px;
padding: 15px;
background-color: #9de1fe;
border-radius: 5px;
}
.post b {
margin-right: 5;
}
.post img {
display: block;
margin: 10px 0;
}
================================================
FILE: examples/install.sh
================================================
#!/bin/bash
# README
# This will install nodejs and npm on your system,
# should work on most places other than Windows.
# For it to run on boot as a server, a recent OS is needed.
# Set any environment variables before you run this,
# like `export RAD=false` to disable storage, or
# pass file paths of `HTTPS_CERT` & `HTTPS_KEY`, etc.
# Copy paste and run each line into your terminal.
# If you are on Windows, http://nodejs.org/download/ has
# an installer that will automatically do it for you.
# curl -o- https://raw.githubusercontent.com/amark/gun/master/examples/install.sh | bash
# wget -O - https://raw.githubusercontent.com/amark/gun/master/examples/install.sh | bash
#debian/ubuntu
cd ~
apt-get install sudo -y
sudo apt-get update -y
sudo apt-get install curl git git-core systemd -y
sudo apt-get install systemctl -y
#fedora/openSUSE
sudo yum check-update -y
sudo yum install curl git git-core systemd -y
sudo yum install systemctl -y
#screen -S install # You can safely CTRL+A+D to escape without stopping the process. `screen -R install` to resume. Stop all with `killall screen`. Note: May need to `sudo apt-get install screen`
# install nodejs
git clone https://github.com/isaacs/nave.git
./nave/nave.sh usemain stable
# If you just want nodejs and npm but not gun, stop here.
#npm install gun@latest
#cd ./node_modules/gun
mkdir node_modules
git clone https://github.com/amark/gun.git
cd gun
git checkout .
git pull
git checkout master
git checkout $VERSION
git pull
npm install .
cp ./examples/relay.service /lib/systemd/system/relay.service
echo $PWD >> /lib/systemd/system/relay.service
echo "fs.file-max = 999999" >> /etc/sysctl.conf
ulimit -u unlimited
sysctl -p /etc/sysctl.conf
systemctl daemon-reload
systemctl enable relay
systemctl restart relay
================================================
FILE: examples/jquery.js
================================================
/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="1.12.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(n.isPlainObject(c)||(b=n.isArray(c)))?(b?(b=!1,f=a&&n.isArray(a)?a:[]):f=a&&n.isPlainObject(a)?a:{},g[d]=n.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray||function(a){return"array"===n.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;try{if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(!l.ownFirst)for(b in a)return k.call(a,b);for(b in a);return void 0===b||k.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(b){b&&n.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(h)return h.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(f=a[b],b=a,a=f),n.isFunction(a)?(c=e.call(arguments,2),d=function(){return a.apply(b||this,c.concat(e.call(arguments)))},d.guid=a.guid=a.guid||n.guid++,d):void 0},now:function(){return+new Date},support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ga(),z=ga(),A=ga(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+M+"))|)"+L+"*\\]",O=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+N+")*)|.*)\\)|)",P=new RegExp(L+"+","g"),Q=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),R=new RegExp("^"+L+"*,"+L+"*"),S=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),T=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),U=new RegExp(O),V=new RegExp("^"+M+"$"),W={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M+"|[*])"),ATTR:new RegExp
gitextract_sxejevxy/
├── .dockerignore
├── .github/
│ ├── FUNDING.yml
│ └── workflows/
│ └── ci.yml
├── .gitignore
├── .npmignore
├── .prettierignore
├── .travis.yml
├── CHANGELOG.md
├── Dockerfile
├── LICENSE.md
├── Procfile
├── README.md
├── RELEASE.md
├── SECURITY.md
├── app.json
├── as.js
├── axe.js
├── bower.json
├── browser.js
├── examples/
│ ├── .gitignore
│ ├── Main.js
│ ├── angular/
│ │ ├── .angular-cli.json
│ │ ├── .editorconfig
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── e2e/
│ │ │ ├── app.e2e-spec.ts
│ │ │ ├── app.po.ts
│ │ │ └── tsconfig.e2e.json
│ │ ├── example_package.json
│ │ ├── karma.conf.js
│ │ ├── protractor.conf.js
│ │ ├── server.js
│ │ ├── src/
│ │ │ ├── app/
│ │ │ │ ├── app.component.css
│ │ │ │ ├── app.component.html
│ │ │ │ ├── app.component.spec.ts
│ │ │ │ ├── app.component.ts
│ │ │ │ ├── app.module.ts
│ │ │ │ ├── gun.helper.ts
│ │ │ │ └── gun.service.ts
│ │ │ ├── assets/
│ │ │ │ └── .gitkeep
│ │ │ ├── environments/
│ │ │ │ ├── environment.prod.ts
│ │ │ │ └── environment.ts
│ │ │ ├── index.html
│ │ │ ├── main.ts
│ │ │ ├── polyfills.ts
│ │ │ ├── styles.css
│ │ │ ├── test.ts
│ │ │ ├── tsconfig.app.json
│ │ │ ├── tsconfig.spec.json
│ │ │ └── typings.d.ts
│ │ ├── tsconfig.json
│ │ └── tslint.json
│ ├── axe.html
│ ├── basic/
│ │ ├── chat.html
│ │ ├── emoji.html
│ │ ├── meet.html
│ │ ├── note.html
│ │ ├── paste.html
│ │ ├── poll.html
│ │ ├── post.html
│ │ ├── private.html
│ │ ├── schedule.html
│ │ ├── screen.html
│ │ ├── stream.html
│ │ ├── tables.html
│ │ ├── upload.html
│ │ ├── user.html
│ │ └── video.html
│ ├── chat/
│ │ ├── index.html
│ │ └── user.html
│ ├── contact/
│ │ └── index.html
│ ├── docs.html
│ ├── express.js
│ ├── game/
│ │ ├── furball.html
│ │ ├── nts.html
│ │ ├── space.html
│ │ └── win.html
│ ├── hapi.js
│ ├── http.js
│ ├── https.sh
│ ├── index.html
│ ├── infinite-scroll/
│ │ ├── ScrollWindow.js
│ │ ├── index.html
│ │ ├── index.js
│ │ └── style.css
│ ├── install.sh
│ ├── jquery.js
│ ├── json/
│ │ └── index.html
│ ├── move/
│ │ └── index.html
│ ├── party.html
│ ├── react/
│ │ ├── README.md
│ │ ├── public/
│ │ │ └── index.html
│ │ ├── src/
│ │ │ ├── App.js
│ │ │ ├── App.test.js
│ │ │ ├── Chat.js
│ │ │ ├── Json.js
│ │ │ ├── Todos.js
│ │ │ ├── index.css
│ │ │ ├── index.js
│ │ │ └── style.css
│ │ └── todo.html
│ ├── react-native/
│ │ ├── .babelrc
│ │ ├── .buckconfig
│ │ ├── .flowconfig
│ │ ├── .gitattributes
│ │ ├── .gitignore
│ │ ├── .watchmanconfig
│ │ ├── README.md
│ │ ├── android/
│ │ │ ├── app/
│ │ │ │ ├── BUCK
│ │ │ │ ├── build.gradle
│ │ │ │ ├── proguard-rules.pro
│ │ │ │ └── src/
│ │ │ │ └── main/
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ ├── assets/
│ │ │ │ │ └── html/
│ │ │ │ │ └── blank.html
│ │ │ │ ├── java/
│ │ │ │ │ └── com/
│ │ │ │ │ └── gundemo/
│ │ │ │ │ ├── MainActivity.java
│ │ │ │ │ └── MainApplication.java
│ │ │ │ └── res/
│ │ │ │ └── values/
│ │ │ │ ├── strings.xml
│ │ │ │ └── styles.xml
│ │ │ ├── build.gradle
│ │ │ ├── gradle/
│ │ │ │ └── wrapper/
│ │ │ │ ├── gradle-wrapper.jar
│ │ │ │ └── gradle-wrapper.properties
│ │ │ ├── gradle.properties
│ │ │ ├── gradlew
│ │ │ ├── gradlew.bat
│ │ │ ├── keystores/
│ │ │ │ ├── BUCK
│ │ │ │ └── debug.keystore.properties
│ │ │ └── settings.gradle
│ │ ├── app.json
│ │ ├── index.js
│ │ ├── ios/
│ │ │ ├── GunDemo/
│ │ │ │ ├── AppDelegate.h
│ │ │ │ ├── AppDelegate.m
│ │ │ │ ├── Base.lproj/
│ │ │ │ │ └── LaunchScreen.xib
│ │ │ │ ├── Images.xcassets/
│ │ │ │ │ ├── AppIcon.appiconset/
│ │ │ │ │ │ └── Contents.json
│ │ │ │ │ └── Contents.json
│ │ │ │ ├── Info.plist
│ │ │ │ └── main.m
│ │ │ ├── GunDemo-tvOS/
│ │ │ │ └── Info.plist
│ │ │ ├── GunDemo-tvOSTests/
│ │ │ │ └── Info.plist
│ │ │ ├── GunDemo.xcodeproj/
│ │ │ │ └── project.pbxproj
│ │ │ └── GunDemoTests/
│ │ │ ├── GunDemoTests.m
│ │ │ └── Info.plist
│ │ ├── package.json
│ │ ├── shim.js
│ │ └── src/
│ │ ├── App/
│ │ │ ├── Demo.js
│ │ │ ├── PolyFillCrypto.js
│ │ │ ├── app.js
│ │ │ └── index.js
│ │ ├── extensions/
│ │ │ ├── asyncStorageAdapter.js
│ │ │ └── sea.js
│ │ └── webview-crypto/
│ │ ├── MainWorker.d.ts
│ │ ├── MainWorker.js
│ │ ├── WebViewWorker.d.ts
│ │ ├── WebViewWorker.js
│ │ ├── asyncSerialize.d.ts
│ │ ├── asyncSerialize.js
│ │ ├── compat.d.ts
│ │ ├── compat.js
│ │ ├── index.d.ts
│ │ ├── index.js
│ │ ├── serializeBinary.d.ts
│ │ ├── serializeBinary.js
│ │ ├── webViewWorkerString.d.ts
│ │ └── webViewWorkerString.js
│ ├── relay-sqlite-example/
│ │ ├── README.md
│ │ ├── capacitor.config.ts
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── App.vue
│ │ │ ├── components/
│ │ │ │ └── RelayMode.vue
│ │ │ ├── composables/
│ │ │ │ ├── GunStorageAdapter.ts
│ │ │ │ ├── useNetwork.ts
│ │ │ │ ├── useNetworkStatus.ts
│ │ │ │ └── useToast.ts
│ │ │ ├── main.ts
│ │ │ ├── pages/
│ │ │ │ └── index.vue
│ │ │ ├── router/
│ │ │ │ └── index.ts
│ │ │ ├── services/
│ │ │ │ ├── dbVersionService.ts
│ │ │ │ ├── globalServices.ts
│ │ │ │ ├── initializeAppService.ts
│ │ │ │ ├── sqliteService.ts
│ │ │ │ └── storageService.ts
│ │ │ └── theme/
│ │ │ └── variables.css
│ │ ├── tsconfig.json
│ │ ├── tsconfig.node.json
│ │ └── vite.config.ts
│ ├── relay.service
│ ├── smoothie.js
│ ├── start.js.html
│ ├── stats.html
│ ├── style.css
│ ├── todo/
│ │ └── index.html
│ ├── vanilla/
│ │ ├── screen.html
│ │ ├── todo.html
│ │ ├── user.html
│ │ └── video.html
│ ├── vue/
│ │ ├── index.html
│ │ └── todo.html
│ ├── wave.html
│ ├── webpack/
│ │ ├── .gitignore
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── app.js
│ │ │ └── index.html
│ │ └── webpack.config.js
│ └── where/
│ └── index.html
├── gun.d.ts
├── gun.js
├── hooks/
│ ├── build
│ └── post_push
├── index.d.ts
├── index.js
├── kit/
│ ├── web.css
│ └── web.js
├── lib/
│ ├── afore.js
│ ├── aws.js
│ ├── axe.js
│ ├── book.js
│ ├── bye.js
│ ├── crashed.js
│ ├── cryptomodules.js
│ ├── debug.js
│ ├── dom.js
│ ├── email.js
│ ├── erase.js
│ ├── evict.js
│ ├── file.js
│ ├── forget.js
│ ├── fork.js
│ ├── fsrm.js
│ ├── fun.js
│ ├── hot.js
│ ├── http.js
│ ├── hub.js
│ ├── ipfs.js
│ ├── ison.js
│ ├── jsonp.js
│ ├── later.d.ts
│ ├── later.js
│ ├── les.js
│ ├── level.js
│ ├── lex.js
│ ├── list.js
│ ├── load.d.ts
│ ├── load.js
│ ├── match.js
│ ├── memdisk.js
│ ├── meta.js
│ ├── mix.js
│ ├── mobile.js
│ ├── monotype.js
│ ├── multicast.js
│ ├── nomem.js
│ ├── normalize.js
│ ├── not.d.ts
│ ├── not.js
│ ├── open.d.ts
│ ├── open.js
│ ├── path.d.ts
│ ├── path.js
│ ├── promise.d.ts
│ ├── promise.js
│ ├── radisk.d.ts
│ ├── radisk.js
│ ├── radisk2.js
│ ├── radix.d.ts
│ ├── radix.js
│ ├── radix2.js
│ ├── radmigtmp.js
│ ├── ras.js
│ ├── reboot.js
│ ├── rfs.js
│ ├── rfsmix.js
│ ├── rindexed.d.ts
│ ├── rindexed.js
│ ├── rls.js
│ ├── rmem.js
│ ├── role.js
│ ├── rs3.js
│ ├── serve.js
│ ├── server.js
│ ├── service.js
│ ├── shim.js
│ ├── space.js
│ ├── stats.js
│ ├── store.d.ts
│ ├── store.js
│ ├── super.js
│ ├── text-encoding/
│ │ ├── LICENSE.md
│ │ ├── README.md
│ │ ├── index.js
│ │ ├── lib/
│ │ │ ├── encoding-indexes.js
│ │ │ └── encoding.js
│ │ └── package.json
│ ├── then.d.ts
│ ├── then.js
│ ├── time.js
│ ├── unbuild.js
│ ├── unset.d.ts
│ ├── unset.js
│ ├── untitled.js
│ ├── upload.js
│ ├── utils.js
│ ├── uws.js
│ ├── verify.js
│ ├── wave.js
│ ├── webrtc.d.ts
│ ├── webrtc.js
│ ├── wire.js
│ ├── ws.js
│ ├── wsp.js
│ ├── wsproto.js
│ └── yson.js
├── nts.js
├── package.json
├── rad.js
├── sea/
│ ├── aeskey.js
│ ├── array.js
│ ├── auth.js
│ ├── base64.js
│ ├── buffer.js
│ ├── certify.js
│ ├── create.js
│ ├── decrypt.js
│ ├── encrypt.js
│ ├── https.js
│ ├── index.js
│ ├── pair.js
│ ├── recall.js
│ ├── root.js
│ ├── sea.js
│ ├── secret.js
│ ├── settings.js
│ ├── sha1.js
│ ├── sha256.js
│ ├── share.js
│ ├── shim.js
│ ├── sign.js
│ ├── then.js
│ ├── user.js
│ ├── verify.js
│ └── work.js
├── sea.d.ts
├── sea.js
├── src/
│ ├── ask.js
│ ├── back.js
│ ├── book.js
│ ├── chain.js
│ ├── core.js
│ ├── dup.js
│ ├── get.js
│ ├── index.js
│ ├── localStorage.js
│ ├── map.js
│ ├── mesh.js
│ ├── on.js
│ ├── onto.js
│ ├── polyfill/
│ │ └── unbuild.js
│ ├── put.js
│ ├── root.js
│ ├── set.js
│ ├── shim.js
│ ├── state.js
│ ├── valid.js
│ └── websocket.js
├── test/
│ ├── abc.js
│ ├── bug/
│ │ ├── 121.js
│ │ ├── 1243.js
│ │ ├── 322.js
│ │ ├── 686.js
│ │ └── 783.js
│ ├── common.js
│ ├── debug/
│ │ └── deep-set.html
│ ├── download-log.html
│ ├── expect.js
│ ├── gun.html
│ ├── https/
│ │ ├── ca.crt
│ │ ├── ca.csr
│ │ ├── ca.key
│ │ ├── server.crt
│ │ ├── server.csr
│ │ ├── server.key
│ │ ├── server.key.passphrase
│ │ └── test.js
│ ├── hub/
│ │ ├── .hubignore
│ │ ├── hub-test.js
│ │ ├── index.html
│ │ └── whatever/
│ │ └── aws-key.txt
│ ├── index.js
│ ├── json2.js
│ ├── mocha.css
│ ├── mocha.html
│ ├── mocha.js
│ ├── normalize/
│ │ └── normalize.html
│ ├── old/
│ │ ├── all.js
│ │ ├── interface.js
│ │ ├── performance.js
│ │ ├── s3pricing.html
│ │ ├── server.js
│ │ ├── set.js
│ │ ├── shoot.html
│ │ ├── shoot.js
│ │ ├── shotgun.js
│ │ ├── timelines.txt
│ │ └── tmp.js
│ ├── panic/
│ │ ├── 1putackget.js
│ │ ├── 2getget.js
│ │ ├── 3puts.js
│ │ ├── 4putackdedup.js
│ │ ├── axe/
│ │ │ ├── 1no_self.js
│ │ │ ├── 2no_dup.js
│ │ │ ├── 3get_turns.js
│ │ │ ├── 4get_subs.js
│ │ │ ├── 5mob.js
│ │ │ ├── index.html
│ │ │ └── load_balance.js
│ │ ├── b2s2s2b.js
│ │ ├── bulkimport.js
│ │ ├── chat-user.js
│ │ ├── chat.js
│ │ ├── curl-server.js
│ │ ├── e2e/
│ │ │ ├── distributed.js
│ │ │ ├── holy/
│ │ │ │ ├── grail.js
│ │ │ │ ├── gun-server.js
│ │ │ │ ├── index.html
│ │ │ │ └── ports.json
│ │ │ └── package.json
│ │ ├── holy-grail.js
│ │ ├── index.html
│ │ ├── infinite-scroll/
│ │ │ ├── index.html
│ │ │ └── index.js
│ │ ├── large-nodes.js
│ │ ├── latency.js
│ │ ├── level.js
│ │ ├── lexical.js
│ │ ├── livestream.js
│ │ ├── load.js
│ │ ├── no-override.js
│ │ ├── on-recovery.js
│ │ ├── radisk.js
│ │ ├── radisk_split_failure.js
│ │ ├── s2s-all-delayed-peer-add.js
│ │ ├── s2s-all.js
│ │ ├── scale.js
│ │ ├── set.js
│ │ ├── shocknet.js
│ │ ├── speak.js
│ │ ├── thread.js
│ │ ├── user-paste.js
│ │ ├── users.js
│ │ ├── util/
│ │ │ ├── load-browser-scripts.js
│ │ │ └── open.js
│ │ └── who.js
│ ├── panic.html
│ ├── ptsd/
│ │ ├── benchmark.js
│ │ ├── memdisk.html
│ │ ├── memdisk.js
│ │ ├── memory.html
│ │ ├── perf.js
│ │ ├── ptsd.html
│ │ ├── ptsd.js
│ │ ├── radix.html
│ │ ├── radix.js
│ │ ├── spam.js
│ │ ├── stool.css
│ │ └── streampipe.js
│ ├── rad/
│ │ ├── 2020and2021.js
│ │ ├── bench.js
│ │ ├── book.html
│ │ ├── book.js
│ │ ├── browser.html
│ │ ├── crash.js
│ │ ├── mocha.html
│ │ ├── old2020json/
│ │ │ ├── !
│ │ │ └── %1C
│ │ ├── parse.rad
│ │ ├── rad.book.spec.js
│ │ ├── rad.js
│ │ └── recover.js
│ ├── radix.js
│ ├── sea/
│ │ ├── nodeauth.js
│ │ ├── sea-tmp.html
│ │ ├── sea.html
│ │ ├── sea.js
│ │ └── sea_old.js
│ ├── server/
│ │ ├── http.js
│ │ ├── node-client.js
│ │ └── node-write.js
│ ├── tmp/
│ │ ├── bigsync.js
│ │ ├── contact.html
│ │ ├── contacts.html
│ │ ├── indexedDB.html
│ │ ├── mitra/
│ │ │ ├── client_to_server.js
│ │ │ └── gun_https2.js
│ │ ├── radisk.html
│ │ ├── say.html
│ │ ├── seanode.js
│ │ ├── space.html
│ │ ├── time.html
│ │ └── tmp.html
│ ├── trace.html
│ ├── trace.js
│ └── wire.txt
├── tsconfig.json
└── types/
├── gun/
│ ├── GunCallbackGet.d.ts
│ ├── GunCallbackMap.d.ts
│ ├── GunCallbackOn.d.ts
│ ├── GunCallbackOnce.d.ts
│ ├── GunCallbackPut.d.ts
│ ├── GunDataNode.d.ts
│ ├── GunHookCallbackBye.d.ts
│ ├── GunHookCallbackCreate.d.ts
│ ├── GunHookCallbackGet.d.ts
│ ├── GunHookCallbackHi.d.ts
│ ├── GunHookCallbackIn.d.ts
│ ├── GunHookCallbackOpt.d.ts
│ ├── GunHookCallbackOut.d.ts
│ ├── GunHookCallbackPut.d.ts
│ ├── GunNodeGet.d.ts
│ ├── GunNodePut.d.ts
│ ├── GunOptions.d.ts
│ ├── GunOptionsOn.d.ts
│ ├── GunOptionsOnce.d.ts
│ ├── GunOptionsPut.d.ts
│ ├── GunPeer.d.ts
│ ├── GunSchema.d.ts
│ ├── GunSoul.d.ts
│ ├── GunValueSimple.d.ts
│ ├── IGun.d.ts
│ ├── IGunChain.d.ts
│ ├── IGunHookContext.d.ts
│ ├── IGunInstance.d.ts
│ ├── IGunInstanceHookHandler.d.ts
│ ├── IGunInstanceRoot.d.ts
│ ├── IGunMeta.d.ts
│ ├── IGunOnEvent.d.ts
│ ├── LEX.d.ts
│ ├── LEXQuery.d.ts
│ ├── _GunRoot.d.ts
│ ├── index.d.ts
│ └── pany.d.ts
├── index.d.ts
├── sea/
│ ├── GunCallbackUserAuth.d.ts
│ ├── GunCallbackUserCreate.d.ts
│ ├── GunHookCallbackAuth.d.ts
│ ├── GunUser.d.ts
│ ├── IGun.d.ts
│ ├── IGunInstance.d.ts
│ ├── IGunInstanceHookHandler.d.ts
│ ├── IGunInstanceRoot.d.ts
│ ├── IGunUserInstance.d.ts
│ ├── IPolicy.d.ts
│ ├── ISEA.d.ts
│ ├── ISEAPair.d.ts
│ ├── OptionsUserAuth.d.ts
│ ├── OptionsUserRecall.d.ts
│ ├── Policy.d.ts
│ └── index.d.ts
├── test/
│ ├── gun-back.test-d.ts
│ ├── gun-get.test-d.ts
│ ├── gun-instance.test-d.ts
│ ├── gun-map.test-d.ts
│ ├── gun-on.test-d.ts
│ ├── gun-once.test-d.ts
│ ├── gun-opt.test-d.ts
│ ├── gun-put.test-d.ts
│ ├── gun-set.test-d.ts
│ ├── gun-user-auth.test-d.ts
│ ├── gun-user-leave.test-d.ts
│ ├── gun-user-recall.test-d.ts
│ ├── gun-user.test-d.ts
│ ├── sea-certify.test-d.ts
│ └── sea.test-d.ts
└── utils.d.ts
SYMBOL INDEX (1240 symbols across 223 files)
FILE: as.js
function as (line 2) | function as(el, gun, cb, opt){
function r (line 173) | function r(href){
FILE: axe.js
function start (line 16) | function start(root){
FILE: examples/Main.js
constant APPLICATIONS (line 56) | const APPLICATIONS = [ // TODO: move editable shortcuts to State.local gun
class MenuView (line 107) | class MenuView extends Component {
method componentDidMount (line 108) | componentDidMount() {
method render (line 112) | render() {
class Main (line 137) | class Main extends Component {
method constructor (line 138) | constructor() {
method componentDidMount (line 143) | componentDidMount() {
method handleRoute (line 147) | handleRoute(e) {
method onClickOverlay (line 158) | onClickOverlay() {
method toggleMenu (line 164) | toggleMenu(show) {
method render (line 168) | render() {
FILE: examples/angular/e2e/app.po.ts
class AngularPage (line 3) | class AngularPage {
method navigateTo (line 4) | navigateTo() {
method getParagraphText (line 8) | getParagraphText() {
FILE: examples/angular/protractor.conf.js
method onPrepare (line 27) | onPrepare() {
FILE: examples/angular/src/app/app.component.ts
class AppComponent (line 14) | class AppComponent implements OnInit {
method constructor (line 22) | constructor(private db: GunDb) { }
method ngOnInit (line 24) | ngOnInit() { }
method add (line 26) | add() {
method delete (line 33) | delete(key: string) {
method sub (line 37) | sub() {
method unsub (line 41) | unsub() {
FILE: examples/angular/src/app/app.module.ts
class AppModule (line 24) | class AppModule { }
FILE: examples/angular/src/app/gun.helper.ts
function on$ (line 5) | function on$(node, cleanup = true): Observable<any> {
function val$ (line 25) | function val$(node): Observable<any> {
FILE: examples/angular/src/app/gun.service.ts
class GunDb (line 5) | class GunDb {
FILE: examples/angular/src/typings.d.ts
type NodeModule (line 3) | interface NodeModule {
FILE: examples/hapi.js
function runtime (line 17) | async function runtime() {
FILE: examples/infinite-scroll/ScrollWindow.js
constant DEFAULT_OPTIONS (line 1) | const DEFAULT_OPTIONS = {
class ScrollWindow (line 6) | class ScrollWindow {
method constructor (line 7) | constructor(gunNode, opts = {}) {
method updateSubscriptions (line 15) | updateSubscriptions() {
method _getSortedKeys (line 38) | _getSortedKeys() {
method _upOrDown (line 43) | _upOrDown(n, up) {
method up (line 57) | up(n) {
method down (line 61) | down(n) {
method _topOrBottom (line 65) | _topOrBottom(top) {
method top (line 71) | top() {
method bottom (line 75) | bottom() {
method _addElement (line 79) | _addElement(key, val) {
method getElements (line 113) | getElements() {
FILE: examples/infinite-scroll/index.js
function debounce (line 6) | function debounce(func, wait, immediate) {
FILE: examples/jquery.js
function s (line 2) | function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"funct...
function fa (line 2) | function fa(a,b,d,e){var f,h,j,k,l,o,r,s,w=b&&b.ownerDocument,x=b?b.node...
function ga (line 2) | function ga(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLengt...
function ha (line 2) | function ha(a){return a[u]=!0,a}
function ia (line 2) | function ia(a){var b=n.createElement("div");try{return!!a(b)}catch(c){re...
function ja (line 2) | function ja(a,b){var c=a.split("|"),e=c.length;while(e--)d.attrHandle[c[...
function ka (line 2) | function ka(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sou...
function la (line 2) | function la(a){return function(b){var c=b.nodeName.toLowerCase();return"...
function ma (line 2) | function ma(a){return function(b){var c=b.nodeName.toLowerCase();return(...
function na (line 2) | function na(a){return ha(function(b){return b=+b,ha(function(c,d){var e,...
function oa (line 2) | function oa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}
function pa (line 2) | function pa(){}
function qa (line 2) | function qa(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}
function ra (line 2) | function ra(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.firs...
function sa (line 2) | function sa(a){return a.length>1?function(b,c,d){var e=a.length;while(e-...
function ta (line 2) | function ta(a,b,c){for(var d=0,e=b.length;e>d;d++)fa(a,b[d],c);return c}
function ua (line 2) | function ua(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(...
function va (line 2) | function va(a,b,c,d,e,f){return d&&!d[u]&&(d=va(d)),e&&!e[u]&&(e=va(e,f)...
function wa (line 2) | function wa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.r...
function xa (line 2) | function xa(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var...
function z (line 2) | function z(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){retur...
function F (line 2) | function F(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}
function H (line 2) | function H(a){var b={};return n.each(a.match(G)||[],function(a,c){b[c]=!...
function J (line 2) | function J(){d.addEventListener?(d.removeEventListener("DOMContentLoaded...
function K (line 2) | function K(){(d.addEventListener||"load"===a.event.type||"complete"===d....
function P (line 2) | function P(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace...
function Q (line 3) | function Q(a){var b;for(b in a)if(("data"!==b||!n.isEmptyObject(a[b]))&&...
function R (line 3) | function R(a,b,d,e){if(M(a)){var f,g,h=n.expando,i=a.nodeType,j=i?n.cach...
function S (line 3) | function S(a,b,c){if(M(a)){var d,e,f=a.nodeType,g=f?n.cache:a,h=f?a[n.ex...
function X (line 3) | function X(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:functi...
function ca (line 3) | function ca(a){var b=ba.split("|"),c=a.createDocumentFragment();if(c.cre...
function ea (line 3) | function ea(a,b){var c,d,e=0,f="undefined"!=typeof a.getElementsByTagNam...
function fa (line 3) | function fa(a,b){for(var c,d=0;null!=(c=a[d]);d++)n._data(c,"globalEval"...
function ia (line 3) | function ia(a){Z.test(a.type)&&(a.defaultChecked=a.checked)}
function ja (line 3) | function ja(a,b,c,d,e){for(var f,g,h,i,j,k,m,o=a.length,p=ca(b),q=[],r=0...
function pa (line 3) | function pa(){return!0}
function qa (line 3) | function qa(){return!1}
function ra (line 3) | function ra(){try{return d.activeElement}catch(a){}}
function sa (line 3) | function sa(a,b,c,d,e,f){var g,h;if("object"==typeof b){"string"!=typeof...
function Ca (line 3) | function Ca(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeTyp...
function Da (line 3) | function Da(a){return a.type=(null!==n.find.attr(a,"type"))+"/"+a.type,a}
function Ea (line 3) | function Ea(a){var b=ya.exec(a.type);return b?a.type=b[1]:a.removeAttrib...
function Fa (line 3) | function Fa(a,b){if(1===b.nodeType&&n.hasData(a)){var c,d,e,f=n._data(a)...
function Ga (line 3) | function Ga(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCas...
function Ha (line 3) | function Ha(a,b,c,d){b=f.apply([],b);var e,g,h,i,j,k,m=0,o=a.length,p=o-...
function Ia (line 3) | function Ia(a,b,c){for(var d,e=b?n.filter(b,a):a,f=0;null!=(d=e[f]);f++)...
function La (line 3) | function La(a,b){var c=n(b.createElement(a)).appendTo(b.body),d=n.css(c[...
function Ma (line 3) | function Ma(a){var b=d,c=Ka[a];return c||(c=La(a,b),"none"!==c&&c||(Ja=(...
function k (line 3) | function k(){var k,l,m=d.documentElement;m.appendChild(i),j.style.cssTex...
function Ua (line 3) | function Ua(a,b){return{get:function(){return a()?void delete this.get:(...
function bb (line 3) | function bb(a){if(a in ab)return a;var b=a.charAt(0).toUpperCase()+a.sli...
function cb (line 3) | function cb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.styl...
function db (line 3) | function db(a,b,c){var d=Ya.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[...
function eb (line 3) | function eb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===...
function fb (line 3) | function fb(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f...
function gb (line 4) | function gb(a,b,c,d,e){return new gb.prototype.init(a,b,c,d,e)}
function lb (line 4) | function lb(){return a.setTimeout(function(){hb=void 0}),hb=n.now()}
function mb (line 4) | function mb(a,b){var c,d={height:a},e=0;for(b=b?1:0;4>e;e+=2-b)c=V[e],d[...
function nb (line 4) | function nb(a,b,c){for(var d,e=(qb.tweeners[b]||[]).concat(qb.tweeners["...
function ob (line 4) | function ob(a,b,c){var d,e,f,g,h,i,j,k,m=this,o={},p=a.style,q=a.nodeTyp...
function pb (line 4) | function pb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a...
function qb (line 4) | function qb(a,b,c){var d,e,f=0,g=qb.prefilters.length,h=n.Deferred().alw...
function Cb (line 4) | function Cb(a){return n.attr(a,"class")||""}
function Tb (line 4) | function Tb(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var ...
function Ub (line 4) | function Ub(a,b,c,d){var e={},f=a===Pb;function g(h){var i;return e[h]=!...
function Vb (line 4) | function Vb(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(d in b)voi...
function Wb (line 4) | function Wb(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[...
function Xb (line 4) | function Xb(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])fo...
function y (line 4) | function y(b,c,d,e){var k,s,t,v,x,y=c;2!==u&&(u=2,h&&a.clearTimeout(h),j...
function Yb (line 4) | function Yb(a){return a.style&&a.style.display||n.css(a,"display")}
function Zb (line 4) | function Zb(a){if(!n.contains(a.ownerDocument||d,a))return!0;while(a&&1=...
function dc (line 4) | function dc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||_b....
function hc (line 4) | function hc(){try{return new a.XMLHttpRequest}catch(b){}}
function ic (line 4) | function ic(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(...
function mc (line 4) | function mc(a){return n.isWindow(a)?a:9===a.nodeType?a.defaultView||a.pa...
FILE: examples/react-native/android/app/src/main/java/com/gundemo/MainActivity.java
class MainActivity (line 5) | public class MainActivity extends ReactActivity {
method getMainComponentName (line 11) | @Override
FILE: examples/react-native/android/app/src/main/java/com/gundemo/MainApplication.java
class MainApplication (line 15) | public class MainApplication extends Application implements ReactApplica...
method getUseDeveloperSupport (line 18) | @Override
method getPackages (line 23) | @Override
method getJSMainModuleName (line 31) | @Override
method getReactNativeHost (line 37) | @Override
method onCreate (line 42) | @Override
FILE: examples/react-native/src/App/Demo.js
class Demo (line 24) | class Demo extends React.Component {
method constructor (line 25) | constructor() {
method render (line 108) | render() {
FILE: examples/react-native/src/App/PolyFillCrypto.js
class PolyfillCrypto (line 33) | class PolyfillCrypto extends React.Component {
method shouldComponentUpdate (line 34) | shouldComponentUpdate() {
method render (line 38) | render() {
FILE: examples/react-native/src/App/app.js
class App (line 17) | class App extends Component {
method render (line 18) | render() {
FILE: examples/react-native/src/extensions/sea.js
function USE (line 9) | function USE(arg, req){
function SeaArray (line 51) | function SeaArray() {}
function SafeBuffer (line 81) | function SafeBuffer(...props) {
method from (line 88) | from() {
method alloc (line 132) | alloc(length, fill = 0 /*, enc*/ ) {
method allocUnsafe (line 136) | allocUnsafe(length) {
method concat (line 140) | concat(arr) { // octet array
function User (line 653) | function User(root){
function F (line 656) | function F(){}
function each (line 1015) | function each(msg){ // TODO: Warning: Need to switch to `gun.on('node')`...
function signature (line 1032) | function signature(msg){
function security (line 1044) | function security(msg){
FILE: examples/react-native/src/webview-crypto/MainWorker.d.ts
class MainWorker (line 1) | class MainWorker {
FILE: examples/react-native/src/webview-crypto/MainWorker.js
constant SUBTLE_METHODS (line 3) | const SUBTLE_METHODS = [
class MainWorker (line 44) | class MainWorker {
method constructor (line 46) | constructor(sendToWebView, debug = false) {
method crypto (line 57) | get crypto() {
method subtle (line 65) | get subtle() {
method uuid (line 75) | static uuid() {
method onWebViewMessage (line 83) | onWebViewMessage(message) {
method getRandomValues (line 121) | getRandomValues(array) {
method callMethod (line 136) | callMethod(method, args, waitForArrayBufferView) {
FILE: examples/react-native/src/webview-crypto/WebViewWorker.d.ts
class WebViewWorker (line 1) | class WebViewWorker {
FILE: examples/react-native/src/webview-crypto/WebViewWorker.js
function fulfilled (line 3) | function fulfilled(value) { try { step(generator.next(value)); } catch (...
function rejected (line 4) | function rejected(value) { try { step(generator["throw"](value)); } catc...
function step (line 5) | function step(result) { result.done ? resolve(result.value) : new P(func...
class WebViewWorker (line 12) | class WebViewWorker {
method constructor (line 13) | constructor(sendToMain) {
method onMainMessage (line 17) | onMainMessage(message) {
method send (line 57) | send(data) {
FILE: examples/react-native/src/webview-crypto/asyncSerialize.d.ts
type ISerializer (line 1) | interface ISerializer<T, S> {
FILE: examples/react-native/src/webview-crypto/asyncSerialize.js
function fulfilled (line 3) | function fulfilled(value) { try { step(generator.next(value)); } catch (...
function rejected (line 4) | function rejected(value) { try { step(generator["throw"](value)); } catc...
function step (line 5) | function step(result) { result.done ? resolve(result.value) : new P(func...
class Serialized (line 11) | class Serialized {
function isSerialized (line 13) | function isSerialized(object) {
function toObjects (line 16) | function toObjects(serializers, o) {
function fromObjects (line 36) | function fromObjects(serializers, o) {
FILE: examples/react-native/src/webview-crypto/compat.js
function subtle (line 1) | function subtle() {
FILE: examples/react-native/src/webview-crypto/serializeBinary.d.ts
type IArrayBufferViewWithPromise (line 3) | interface IArrayBufferViewWithPromise extends ArrayBufferView {
FILE: examples/react-native/src/webview-crypto/serializeBinary.js
function fulfilled (line 3) | function fulfilled(value) { try { step(generator.next(value)); } catch (...
function rejected (line 4) | function rejected(value) { try { step(generator["throw"](value)); } catc...
function step (line 5) | function step(result) { result.done ? resolve(result.value) : new P(func...
function parse (line 11) | function parse(text) {
function stringify (line 19) | function stringify(value, waitForArrayBufferView = true) {
function serializers (line 27) | function serializers(waitForArrayBufferView) {
function isArrayBufferViewWithPromise (line 51) | function isArrayBufferViewWithPromise(obj) {
function arrayBufferViewName (line 57) | function arrayBufferViewName(abv) {
function ArrayBufferViewSerializer (line 90) | function ArrayBufferViewSerializer(waitForPromise) {
function hasData (line 112) | function hasData(ck) {
FILE: examples/react/src/App.js
class App (line 7) | class App extends Component {
method constructor (line 8) | constructor() {
method render (line 13) | render() {
FILE: examples/react/src/Chat.js
class Chat (line 10) | class Chat extends Component {
method constructor (line 11) | constructor({gun}) {
method componentWillMount (line 20) | componentWillMount() {
method render (line 42) | render() {
FILE: examples/react/src/Json.js
class Json (line 8) | class Json extends Component {
method constructor (line 9) | constructor({gun}) {
method componentWillMount (line 15) | componentWillMount() {
method render (line 30) | render() {
FILE: examples/react/src/Todos.js
class Todos (line 10) | class Todos extends Component {
method constructor (line 11) | constructor({gun}) {
method componentWillMount (line 17) | componentWillMount() {
method render (line 33) | render() {
FILE: examples/relay-sqlite-example/src/composables/GunStorageAdapter.ts
class RequestQueue (line 16) | class RequestQueue {
method constructor (line 21) | constructor(storageServ: StorageService) {
method get (line 25) | async get(key: string): Promise<any> {
method put (line 52) | async put(soul: string, node: any): Promise<void> {
method batchPut (line 59) | async batchPut(nodes: Record<string, any>): Promise<void> {
type GunAdapter (line 72) | interface GunAdapter {
type IGunSQLiteAdapter (line 78) | interface IGunSQLiteAdapter {
function useGunSQLiteAdapter (line 87) | function useGunSQLiteAdapter(
function getGunSQLiteAdapter (line 191) | function getGunSQLiteAdapter(
FILE: examples/relay-sqlite-example/src/composables/useNetwork.ts
function createNetwork (line 16) | function createNetwork(gunInstance: IGunInstance<any>) {
function useNetwork (line 101) | function useNetwork(gunInstance: IGunInstance<any>) {
function cleanupNetwork (line 109) | function cleanupNetwork() {
FILE: examples/relay-sqlite-example/src/composables/useNetworkStatus.ts
function createNetworkStatus (line 23) | function createNetworkStatus(storageService: StorageService) {
function useNetworkStatus (line 344) | function useNetworkStatus(storageService: StorageService) {
FILE: examples/relay-sqlite-example/src/composables/useToast.ts
type ToastType (line 5) | type ToastType = 'info' | 'success' | 'error' | 'warning';
type ToastMessage (line 7) | interface ToastMessage {
constant SETTINGS_FILE (line 17) | const SETTINGS_FILE = 'toast_settings.json';
function loadSettings (line 19) | async function loadSettings(): Promise<{ isToastEnabled: boolean }> {
function saveSettings (line 35) | async function saveSettings(): Promise<void> {
function showToast (line 49) | function showToast(msg: string, msgType: ToastType = 'info', customDurat...
function hideToast (line 65) | function hideToast(id: number) {
function toggleToast (line 69) | function toggleToast(enabled: boolean) {
function useToast (line 80) | function useToast() {
FILE: examples/relay-sqlite-example/src/services/dbVersionService.ts
type IDbVersionService (line 1) | interface IDbVersionService {
class DbVersionService (line 5) | class DbVersionService implements IDbVersionService {
method setDbVersion (line 8) | setDbVersion(dbName: string, version: number) {
method getDbVersion (line 13) | getDbVersion(dbName: string): number | undefined {
FILE: examples/relay-sqlite-example/src/services/initializeAppService.ts
type IInitializeAppService (line 4) | interface IInitializeAppService {
class InitializeAppService (line 8) | class InitializeAppService implements IInitializeAppService {
method constructor (line 15) | constructor(sqliteService: ISQLiteService, storageService: IStorageSer...
method initializeApp (line 20) | async initializeApp(): Promise<boolean> {
FILE: examples/relay-sqlite-example/src/services/sqliteService.ts
type ISQLiteService (line 4) | interface ISQLiteService {
class SQLiteService (line 15) | class SQLiteService implements ISQLiteService {
method getPlatform (line 21) | getPlatform(): string {
method initWebStore (line 24) | async initWebStore() : Promise<void> {
method addUpgradeStatement (line 33) | async addUpgradeStatement(options: capSQLiteUpgradeOptions): Promise<v...
method openDatabase (line 42) | async openDatabase(dbName:string, loadToVersion: number,
method isConnection (line 69) | async isConnection(dbName:string, readOnly: boolean): Promise<boolean> {
method closeDatabase (line 83) | async closeDatabase(dbName:string, readOnly: boolean):Promise<void> {
method saveToStore (line 95) | async saveToStore(dbName: string): Promise<void> {
method saveToLocalDisk (line 104) | async saveToLocalDisk(dbName: string): Promise<void> {
FILE: examples/relay-sqlite-example/src/services/storageService.ts
type IStorageService (line 8) | interface IStorageService {
class StorageService (line 18) | class StorageService implements IStorageService {
method constructor (line 59) | constructor(sqliteService: ISQLiteService, dbVersionService: IDbVersio...
method initializeDatabase (line 65) | async initializeDatabase(): Promise<void> {
method query (line 122) | async query(sql: string, params: any[] = []): Promise<any> {
method run (line 131) | async run(sql: string, params: any[] = []): Promise<any> {
method execute (line 140) | async execute(sql: string): Promise<any> {
FILE: examples/relay-sqlite-example/vite.config.ts
method manualChunks (line 59) | manualChunks(id) {
FILE: examples/smoothie.js
function TimeSeries (line 156) | function TimeSeries(options) {
function SmoothieChart (line 330) | function SmoothieChart(options) {
function pad2 (line 1097) | function pad2(number) { return (number < 10 ? '0' : '') + number }
FILE: gun.d.ts
type IGun (line 8) | interface IGun {
type Window (line 14) | interface Window {
type StringConstructor (line 19) | interface StringConstructor {
FILE: gun.js
function USE (line 4) | function USE(arg, req){
function page (line 167) | function page(word){
function get (line 174) | function get(word){
function got (line 184) | function got(word, page){
function spot (line 201) | function spot(word, sorted, parse){ parse = parse || spot.no || (spot.no...
function from (line 209) | function from(a, t, l){
function list (line 215) | function list(each){ each = each || function(x){return x}
function set (line 222) | function set(word, is){
function split (line 242) | function split(p, b){ // TODO: use closest hash instead of half.
function slot (line 262) | function slot(t){ return heal((t=t||'').substring(1, t.length-1).split(t...
function heal (line 263) | function heal(l, s){ var i, e;
function size (line 272) | function size(t){ return (t||'').length||1 } // bits/numbers less size? ...
function subt (line 273) | function subt(i,j){ return this.word }
function tot (line 275) | function tot(){ var tmp = {};
function sub (line 282) | function sub(i,j){ return (this.first||this.word||B.decode((from(this)||...
function to (line 283) | function to(){ return this.text = this.text || text(this) }
function text (line 284) | function text(p){ // PERF: read->[*] : text->"*" no edit waste 1 time perf.
function sort (line 289) | function sort(p, l){
function mix (line 296) | function mix(p, l){ // TODO: IMPROVE PERFORMANCE!!!! l[j] = i is 5X+ fas...
function record (line 345) | function record(key, val){ return key+B.encode(val)+"%"+key.length }
function decord (line 346) | function decord(t){
function State (line 374) | function State(){
function Dup (line 403) | function Dup(opt){
function Gun (line 462) | function Gun(o){
function universe (line 500) | function universe(msg){
function put (line 523) | function put(msg){
function ham (line 578) | function ham(val, key, soul, state, msg){
function map (line 600) | function map(msg){
function fire (line 614) | function fire(ctx, msg){ var root;
function ack (line 629) | function ack(msg){ // aggregate ACKs.
function back (line 646) | function back(ctx){
function ack (line 703) | function ack(msg, node){
function output (line 829) | function output(msg){
function input (line 911) | function input(msg, cat){ cat = cat || this.as; // TODO: V8 may not be a...
function link (line 968) | function link(msg, cat){ cat = cat || this.as || msg.$._;
function unlink (line 996) | function unlink(msg, cat){ // ugh, so much code for seemingly edge case ...
function ack (line 1037) | function ack(msg, ev){
function any (line 1090) | function any(msg, eve, f){
function cache (line 1171) | function cache(key, back){
function soul (line 1187) | function soul(gun, cb, opt, as){
function rid (line 1207) | function rid(at){
function resolve (line 1268) | function resolve(msg, eve){
function stun (line 1300) | function stun(as, id){
function ran (line 1322) | function ran(as){
function get (line 1351) | function get(as){
function check (line 1372) | function check(d, tmp){ return ((d && (tmp = d.constructor) && tmp.name)...
function once (line 1471) | function once(f){
function none (line 1490) | function none(gun,opt,chain){
function map (line 1578) | function map(msg){ this.to.next(msg);
function Mesh (line 1619) | function Mesh(root){
function open (line 1986) | function open(peer){ try{
function reconnect (line 2010) | function reconnect(peer){
function flush (line 2071) | function flush(){
function map (line 2177) | function map(v,k){
function empty (line 2191) | function empty(v,i){ var n = this.n, u;
function t (line 2201) | function t(k,v){
function map (line 2277) | function map(s, k){ var o = this; // map over the object...
function map (line 2314) | function map(v, k){ // we invert this because the way we check for this ...
function map (line 2331) | function map(v, k){ var o = this.o, tmp, u; // iterate over each key/value.
function map (line 2382) | function map(v,k){
function map (line 2398) | function map(n, s){ // we invert this because the way'? we check for thi...
function nf (line 2404) | function nf(fn){ // optional callback for each node.
function node (line 2435) | function node(env, at){ var tmp;
function map (line 2447) | function map(v,k,n){
function soul (line 2480) | function soul(id){ var at = this;
function valid (line 2492) | function valid(v,k,n, at,env){ var tmp;
function seen (line 2502) | function seen(env, at){
function map (line 2523) | function map(v,k){ var tmp, obj;
FILE: index.d.ts
constant SEA (line 10) | const SEA: ISEA;
type StringConstructor (line 15) | interface StringConstructor {
FILE: kit/web.js
function LOAD (line 11) | function LOAD(src, h, s){ (s = D[HI]('script')).onload = h; s.src = src;...
function MAP (line 12) | function MAP(scroll, screen){ return (scroll / screen)>>0 }
method get (line 99) | get(){ return kit.path }
method set (line 100) | set(path){ if(!path){ return }
method createReadStream (line 113) | createReadStream(url){ url = (url||'').replace(location.__dirname+'/',''...
function change (line 153) | function change(eve){ eve = eve||''; eve = eve.detail||eve.data||eve;
FILE: lib/afore.js
function afore (line 1) | function afore(tag, hear){
FILE: lib/aws.js
function s3 (line 3) | function s3(opt){
FILE: lib/axe.js
function start (line 8) | function start(root){
FILE: lib/crashed.js
function noop (line 18) | function noop(){}
function email (line 19) | function email(){ try{
FILE: lib/dom.js
function rev (line 54) | function rev(o, I){ (I = $()).tags = [].slice.call(o.tags).reverse(); re...
FILE: lib/evict.js
function check (line 16) | function check(){
function GC (line 25) | function GC(){
FILE: lib/file.js
function match (line 82) | function match(at){
FILE: lib/forget.js
function once (line 9) | function once(root){
FILE: lib/hub.js
function watch (line 17) | function watch(what, options) {
FILE: lib/ison.js
function StringifyError (line 26) | function StringifyError(m) {
function ParseError (line 315) | function ParseError(m) {
FILE: lib/later.d.ts
type IGunChain (line 3) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/les.js
function enqueueNode (line 139) | function enqueueNode(soul, ctime) {
function dequeueNode (line 158) | function dequeueNode(soul) {
function collectNode (line 172) | function collectNode(soul) {
function GC (line 187) | function GC(memRatio) {
function round (line 219) | function round(value, decimals) { //a basic rounding function
FILE: lib/lex.js
function Lex (line 9) | function Lex() {}
FILE: lib/load.d.ts
type IGunChain (line 3) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/match.js
function match (line 2) | function match(t, o){ var r = false;
FILE: lib/meta.js
function USE (line 2) | function USE(arg, req){
function withMeta (line 20) | function withMeta(eve){ return eve.metaKey || eve.ctrlKey || eve.altKey ...
function defaultSort (line 83) | function defaultSort(a,b){
function back (line 147) | function back(){ // close root or go back on submenu
function css (line 254) | function css(css){
FILE: lib/multicast.js
function say (line 72) | function say(msg){
function check (line 78) | function check(id, info){ var tmp;
FILE: lib/nomem.js
function Nomem (line 1) | function Nomem(){
FILE: lib/normalize.js
function addUnstable (line 62) | function addUnstable(a) { // NOT ES5
function initTag (line 69) | function initTag(a) {
function stateMachine (line 85) | function stateMachine() {
function prepareOptTags (line 97) | function prepareOptTags(opt) {
function get (line 120) | function get(o, args){ // path arguments as separate string parameters
function has (line 128) | function has(obj,prop){
function tag (line 134) | function tag(e){
function joint (line 138) | function joint(e, d){
function attrsAsObj (line 148) | function attrsAsObj(e, filterCb){
function sameAttrs (line 162) | function sameAttrs(a, b) {
function parseAndRemoveAttrs (line 168) | function parseAndRemoveAttrs(a) {
function setAttrs (line 181) | function setAttrs(a){
function convert (line 191) | function convert(a){
function exclude (line 200) | function exclude(a, addUnstable){
function moveSpaceUp (line 211) | function moveSpaceUp(a, addUnstable){
function moveSpace (line 224) | function moveSpace(n, bef) {
function next (line 251) | function next(a, addUnstable, t){
function empty (line 270) | function empty(a){
function parentOrderWrap (line 278) | function parentOrderWrap(a, addUnstable){
FILE: lib/not.d.ts
type IGunChain (line 3) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/not.js
function ought (line 13) | function ought(at, ev){ ev.off();
FILE: lib/open.d.ts
type IGunChain (line 3) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/path.d.ts
type IGunInstance (line 5) | interface IGunInstance<TNode> {
type IGunChain (line 31) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/promise.d.ts
type IGunInstance (line 16) | interface IGunInstance<TNode> {
type IGunChain (line 33) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/promise.js
function sleep (line 54) | function sleep (limit) {
FILE: lib/radisk.d.ts
type IRadisk (line 6) | interface IRadisk {
type Window (line 12) | interface Window {
FILE: lib/radisk.js
function Radisk (line 3) | function Radisk(opt){
FILE: lib/radisk2.js
function Radisk (line 4) | function Radisk(opt){
FILE: lib/radix.d.ts
type IRadix (line 4) | interface IRadix {}
type Window (line 8) | interface Window {
FILE: lib/radix.js
function Radix (line 3) | function Radix(){
FILE: lib/radix2.js
function Radix (line 3) | function Radix(){
FILE: lib/ras.js
function Store (line 11) | function Store(opt){
FILE: lib/rfs.js
function Store (line 1) | function Store(opt){
FILE: lib/rindexed.d.ts
type IRindexedDB (line 4) | interface IRindexedDB {
type Window (line 11) | interface Window {
FILE: lib/rindexed.js
function Store (line 13) | function Store(opt){
FILE: lib/rls.js
function Store (line 3) | function Store(opt){
FILE: lib/rmem.js
function Rmem (line 1) | function Rmem(){
FILE: lib/role.js
function resolve (line 3) | function resolve(chain){
function off (line 63) | function off(chain){
function soul (line 82) | function soul(chain){
function Role (line 119) | function Role(){}
FILE: lib/rs3.js
function Store (line 39) | function Store(opt){
FILE: lib/serve.js
function CDN (line 6) | function CDN(dir){
function serve (line 21) | function serve(req, res, next){ var tmp;
FILE: lib/space.js
function travel (line 53) | function travel(key, cb, opt, ref){
function find (line 77) | function find(o, cb, root){
function index (line 102) | function index(n, m, l, k){
FILE: lib/store.js
function each (line 124) | function each(val, has, a,b){ // TODO: THIS CODE NEEDS TO BE FASTER!!!!
FILE: lib/super.js
function input (line 6) | function input(msg){
FILE: lib/text-encoding/lib/encoding.js
function inRange (line 28) | function inRange(a, min, max) {
function includes (line 37) | function includes(array, item) {
function ToDictionary (line 47) | function ToDictionary(o) {
function stringToCodePoints (line 57) | function stringToCodePoints(string) {
function codePointsToString (line 140) | function codePointsToString(code_points) {
function isASCIIByte (line 170) | function isASCIIByte(a) {
function Stream (line 194) | function Stream(tokens) {
function decoderError (line 274) | function decoderError(fatal, opt_code_point) {
function encoderError (line 284) | function encoderError(code_point) {
function Decoder (line 289) | function Decoder() {}
function Encoder (line 302) | function Encoder() {}
function getEncoding (line 321) | function getEncoding(label) {
function indexCodePointFor (line 825) | function indexCodePointFor(pointer, index) {
function indexPointerFor (line 836) | function indexPointerFor(code_point, index) {
function index (line 845) | function index(name) {
function indexGB18030RangesCodePointFor (line 858) | function indexGB18030RangesCodePointFor(pointer) {
function indexGB18030RangesPointerFor (line 895) | function indexGB18030RangesPointerFor(code_point) {
function indexShiftJISPointerFor (line 928) | function indexShiftJISPointerFor(code_point) {
function indexBig5PointerFor (line 948) | function indexBig5PointerFor(code_point) {
function TextDecoder (line 984) | function TextDecoder(label, options) {
function serializeStream (line 1170) | function serializeStream(stream) {
function TextEncoder (line 1206) | function TextEncoder(label, options) {
function UTF8Decoder (line 1339) | function UTF8Decoder(options) {
function UTF8Encoder (line 1480) | function UTF8Encoder(options) {
function SingleByteDecoder (line 1560) | function SingleByteDecoder(index, options) {
function SingleByteEncoder (line 1599) | function SingleByteEncoder(index, options) {
function GB18030Decoder (line 1678) | function GB18030Decoder(options) {
function GB18030Encoder (line 1836) | function GB18030Encoder(options, gbk_flag) {
function Big5Decoder (line 1940) | function Big5Decoder(options) {
function Big5Encoder (line 2040) | function Big5Encoder(options) {
function EUCJPDecoder (line 2105) | function EUCJPDecoder(options) {
function EUCJPEncoder (line 2208) | function EUCJPEncoder(options) {
function ISO2022JPDecoder (line 2279) | function ISO2022JPDecoder(options) {
function ISO2022JPEncoder (line 2588) | function ISO2022JPEncoder(options) {
function ShiftJISDecoder (line 2730) | function ShiftJISDecoder(options) {
function ShiftJISEncoder (line 2829) | function ShiftJISEncoder(options) {
function EUCKRDecoder (line 2911) | function EUCKRDecoder(options) {
function EUCKREncoder (line 2990) | function EUCKREncoder(options) {
function convertCodeUnitToBytes (line 3051) | function convertCodeUnitToBytes(code_unit, utf16be) {
function UTF16Decoder (line 3073) | function UTF16Decoder(utf16_be, options) {
function UTF16Encoder (line 3167) | function UTF16Encoder(utf16_be, options) {
function XUserDefinedDecoder (line 3232) | function XUserDefinedDecoder(options) {
function XUserDefinedEncoder (line 3262) | function XUserDefinedEncoder(options) {
FILE: lib/then.d.ts
type IGunChain (line 5) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/time.js
function travel (line 57) | function travel(cb, opt, b, gun){
function now (line 75) | function now(t){
function find (line 78) | function find(o, cb, root, at, off){
function toDate (line 134) | function toDate(at){
FILE: lib/unset.d.ts
type IGunChain (line 6) | interface IGunChain<TNode, TChainParent, TGunInstance, TKey> {
FILE: lib/untitled.js
function input (line 1) | function input(msg){
function unknown (line 45) | function unknown(ref, key){
FILE: lib/upload.js
function upload (line 2) | function upload(cb, opt){
FILE: lib/utils.js
function map (line 82) | function map(v,k){
function empty (line 96) | function empty(v,i){ var n = this.n, u;
function t (line 106) | function t(k,v){
function map (line 186) | function map(s, k){ var o = this; // map over the object...
function map (line 223) | function map(v, k){ // we invert this because the way we check for this ...
function map (line 240) | function map(v, k){ var o = this.o, tmp, u; // iterate over each key/value.
function map (line 291) | function map(v,k){
function map (line 307) | function map(n, s){ // we invert this because the way'? we check for thi...
function nf (line 313) | function nf(fn){ // optional callback for each node.
function node (line 344) | function node(env, at){ var tmp;
function map (line 356) | function map(v,k,n){
function soul (line 389) | function soul(id){ var at = this;
function valid (line 401) | function valid(v,k,n, at,env){ var tmp;
function seen (line 411) | function seen(env, at){
function map (line 432) | function map(v,k){ var tmp, obj;
FILE: lib/uws.js
function send (line 59) | function send(peer){
function receive (line 69) | function receive(msg, wire, ctx){
function open (line 83) | function open(peer, as){
function reconnect (line 110) | function reconnect(peer, as){
FILE: lib/wave.js
function buildNotes (line 1449) | function buildNotes({startNote, notes, step, skipNotes}) {
FILE: lib/webrtc.js
function plan (line 69) | function plan(msg){
function open (line 90) | function open(msg, rtc, peer){
FILE: lib/wire.js
function open (line 77) | function open(wire, req) {
FILE: lib/ws.js
function send (line 63) | function send(peer){
function receive (line 73) | function receive(msg, wire, ctx){
function open (line 87) | function open(peer, as){
function reconnect (line 114) | function reconnect(peer, as){
FILE: lib/wsp.js
function start (line 8) | function start(server, port, app){
function flow (line 116) | function flow(req, res){
function tran (line 124) | function tran(req, res){
FILE: lib/wsproto.js
function send (line 45) | function send(peer){
function receive (line 55) | function receive(msg, peer, ctx){
function open (line 69) | function open(peer, as){
function reconnect (line 96) | function reconnect(peer, as){
FILE: lib/yson.js
function parse (line 13) | function parse(){
function value (line 146) | function value(s){
function ify (line 172) | function ify(){
FILE: nts.js
function response (line 26) | function response(msg, connection) {
FILE: rad.js
function read (line 28) | async function read(word, reply, page){ // TODO: this function doesn't d...
function write (line 38) | function write(word, reply){
function put (line 53) | function put(file, data, cb){
function get (line 60) | function get(file, cb){
function start (line 73) | function start(word, is, reply){
function watch (line 84) | function watch(b){ // SPLIT LOGIC!
function ename (line 104) | function ename(t){ return encodeURIComponent(t).replace(/\*/g, '%2A').sl...
function fname (line 106) | function fname(p){ return ename(p.substring()) }
function valid (line 108) | function valid(word, is, reply){
FILE: sea.d.ts
type ISEA (line 8) | interface ISEA {
type IGun (line 15) | interface IGun {
type Window (line 21) | interface Window {
FILE: sea.js
function USE (line 4) | function USE(arg, req){
function SeaArray (line 63) | function SeaArray() {}
function SafeBuffer (line 94) | function SafeBuffer(...props) {
method from (line 101) | from() {
method alloc (line 145) | alloc(length, fill = 0 /*, enc*/ ) {
method allocUnsafe (line 149) | allocUnsafe(length) {
method concat (line 153) | concat(arr) { // octet array
function User (line 816) | function User(root){
function F (line 819) | function F(){}
function lex (line 842) | function lex(){ return Gun.state().toString(36).replace('.','') }
function obj_ify (line 1119) | function obj_ify(o){
function check (line 1321) | function check(msg){ // REVISE / IMPROVE, NO NEED TO PASS MSG/EVE EACH SUB?
function hexToBase64 (line 1362) | function hexToBase64(hexStr) {
FILE: sea/array.js
function SeaArray (line 5) | function SeaArray() {}
FILE: sea/auth.js
function obj_ify (line 157) | function obj_ify(o){
FILE: sea/buffer.js
function SafeBuffer (line 10) | function SafeBuffer(...props) {
method from (line 17) | from() {
method alloc (line 61) | alloc(length, fill = 0 /*, enc*/ ) {
method allocUnsafe (line 65) | allocUnsafe(length) {
method concat (line 69) | concat(arr) { // octet array
FILE: sea/index.js
function check (line 31) | function check(msg){ // REVISE / IMPROVE, NO NEED TO PASS MSG/EVE EACH SUB?
function hexToBase64 (line 72) | function hexToBase64(hexStr) {
FILE: sea/user.js
function User (line 11) | function User(root){
function F (line 14) | function F(){}
function lex (line 37) | function lex(){ return Gun.state().toString(36).replace('.','') }
FILE: src/book.js
function page (line 30) | function page(word){
function get (line 37) | function get(word){
function got (line 47) | function got(word, page){
function spot (line 64) | function spot(word, sorted, parse){ parse = parse || spot.no || (spot.no...
function from (line 72) | function from(a, t, l){
function list (line 78) | function list(each){ each = each || function(x){return x}
function set (line 85) | function set(word, is){
function split (line 104) | function split(p, b){ // TODO: use closest hash instead of half.
function slot (line 123) | function slot(t){ return heal((t=t||'').substring(1, t.length-1).split(t...
function heal (line 124) | function heal(l, s){ var i, e;
function size (line 133) | function size(t){ return (t||'').length||1 } // bits/numbers less size? ...
function subt (line 134) | function subt(i,j){ return this.word }
function tot (line 136) | function tot(){ var tmp = {};
function sub (line 143) | function sub(i,j){ return (this.first||this.word||B.decode((from(this)||...
function to (line 144) | function to(){ return this.text = this.text || text(this) }
function text (line 145) | function text(p){ // PERF: read->[*] : text->"*" no edit waste 1 time perf.
function sort (line 150) | function sort(p, l){
function mix (line 157) | function mix(p, l){ // TODO: IMPROVE PERFORMANCE!!!! l[j] = i is 5X+ fas...
function record (line 206) | function record(key, val){ return key+B.encode(val)+"%"+key.length }
function decord (line 207) | function decord(t){
FILE: src/chain.js
function output (line 18) | function output(msg){
function input (line 100) | function input(msg, cat){ cat = cat || this.as; // TODO: V8 may not be a...
function link (line 157) | function link(msg, cat){ cat = cat || this.as || msg.$._;
function unlink (line 185) | function unlink(msg, cat){ // ugh, so much code for seemingly edge case ...
function ack (line 226) | function ack(msg, ev){
FILE: src/dup.js
function Dup (line 4) | function Dup(opt){
FILE: src/get.js
function any (line 27) | function any(msg, eve, f){
function cache (line 108) | function cache(key, back){
function soul (line 124) | function soul(gun, cb, opt, as){
function rid (line 144) | function rid(at){
FILE: src/localStorage.js
function flush (line 48) | function flush(){
FILE: src/map.js
function map (line 38) | function map(msg){ this.to.next(msg);
FILE: src/mesh.js
function Mesh (line 10) | function Mesh(root){
FILE: src/on.js
function once (line 67) | function once(f){
function none (line 86) | function none(gun,opt,chain){
FILE: src/polyfill/unbuild.js
function USE (line 2) | function USE(arg, req){
FILE: src/put.js
function resolve (line 48) | function resolve(msg, eve){
function stun (line 80) | function stun(as, id){
function ran (line 102) | function ran(as){
function get (line 131) | function get(as){
function check (line 152) | function check(d, tmp){ return ((d && (tmp = d.constructor) && tmp.name)...
FILE: src/root.js
function Gun (line 4) | function Gun(o){
function universe (line 42) | function universe(msg){
function put (line 65) | function put(msg){
function ham (line 120) | function ham(val, key, soul, state, msg){
function map (line 142) | function map(msg){
function fire (line 156) | function fire(ctx, msg){ var root;
function ack (line 171) | function ack(msg){ // aggregate ACKs.
function back (line 188) | function back(ctx){
function ack (line 245) | function ack(msg, node){
FILE: src/state.js
function State (line 4) | function State(){
FILE: src/websocket.js
function open (line 24) | function open(peer){ try{
function reconnect (line 48) | function reconnect(peer){
FILE: test/bug/1243.js
function request (line 20) | function request(hostname, done){
function spawn (line 28) | function spawn(cmd, done) {
function makeid (line 55) | function makeid(length) {
FILE: test/common.js
function next (line 89) | function next(){
function Foo (line 106) | function Foo(){}
function flow (line 424) | function flow(){
function next (line 479) | function next(arg){ var n = this;
function end (line 1226) | function end(ack){
function foo (line 3345) | function foo(data){
function run (line 3727) | function run(i){
function soulnode (line 4778) | function soulnode(gun, kn, r){ // TODO: WARNING! Key implementation has ...
function cb (line 5075) | function cb(e,d,f,a){
function cb (line 5098) | function cb(e,d,f,a){
function pushAtoB (line 6474) | function pushAtoB(key){
function pushBtoA (line 6478) | function pushBtoA(key){
function put (line 7288) | function put(num, t) {
function put2 (line 7317) | function put2(num, t) {
function put (line 7563) | function put(d, t, f){
FILE: test/expect.js
function expect (line 30) | function expect (obj) {
function Assertion (line 40) | function Assertion (obj, flag, parent) {
function bind (line 497) | function bind (fn, scope) {
function every (line 510) | function every (arr, fn, thisObj) {
function indexOf (line 527) | function indexOf (arr, o, i) {
function i (line 578) | function i (obj, showHidden, depth) {
function isArray (line 770) | function isArray (ar) {
function isRegExp (line 774) | function isRegExp(re) {
function isDate (line 792) | function isDate(d) {
function keys (line 796) | function keys (obj) {
function map (line 812) | function map (arr, mapper, that) {
function reduce (line 826) | function reduce (arr, fun) {
function isUndefinedOrNull (line 912) | function isUndefinedOrNull (value) {
function isArguments (line 916) | function isArguments (object) {
function regExpEquiv (line 920) | function regExpEquiv (a, b) {
function objEquiv (line 925) | function objEquiv (a, b) {
function f (line 980) | function f(n) {
function date (line 985) | function date(d, key) {
function quote (line 1011) | function quote(string) {
function str (line 1027) | function str(key, holder) {
function walk (line 1202) | function walk(holder, key) {
FILE: test/json2.js
function f (line 170) | function f(n) {
function quote (line 211) | function quote(string) {
function str (line 227) | function str(key, holder) {
function walk (line 408) | function walk(holder, key) {
FILE: test/mocha.js
function s (line 1) | function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&re...
function isArray (line 33) | function isArray(val) {
function EventEmitter (line 42) | function EventEmitter() {}
function on (line 81) | function on() {
function Progress (line 219) | function Progress() {
function Context (line 355) | function Context() {}
function Hook (line 455) | function Hook(title, fn) {
function visit (line 702) | function visit(obj, file) {
function image (line 996) | function image(name) {
function Mocha (line 1018) | function Mocha(options) {
function done (line 1422) | function done(failures) {
function parse (line 1473) | function parse(str) {
function shortFormat (line 1515) | function shortFormat(ms) {
function longFormat (line 1538) | function longFormat(ms) {
function plural (line 1554) | function plural(ms, n, name) {
function Pending (line 1577) | function Pending(message) {
function Base (line 1819) | function Base(runner) {
function pad (line 1925) | function pad(str, len) {
function inlineDiff (line 1938) | function inlineDiff(err, escape) {
function unifiedDiff (line 1972) | function unifiedDiff(err, escape) {
function errorDiff (line 2013) | function errorDiff(err, type, escape) {
function escapeInvisibles (line 2034) | function escapeInvisibles(line) {
function colorLines (line 2048) | function colorLines(name, str) {
function sameType (line 2067) | function sameType(a, b) {
function Doc (line 2092) | function Doc(runner) {
function Dot (line 2158) | function Dot(runner) {
function HTMLCov (line 2228) | function HTMLCov(runner) {
function coverageClass (line 2252) | function coverageClass(coveragePctg) {
function HTML (line 2315) | function HTML(runner) {
function makeUrl (line 2485) | function makeUrl(s) {
function error (line 2519) | function error(msg) {
function fragment (line 2528) | function fragment(html) {
function hideSuitesWithout (line 2550) | function hideSuitesWithout(classname) {
function unhide (line 2563) | function unhide() {
function text (line 2576) | function text(el, contents) {
function on (line 2587) | function on(el, event, fn) {
function JSONCov (line 2638) | function JSONCov(runner, output) {
function map (line 2682) | function map(cov) {
function coverage (line 2722) | function coverage(filename, data) {
function clean (line 2762) | function clean(test) {
function List (line 2791) | function List(runner) {
function clean (line 2825) | function clean(test) {
function JSONReporter (line 2854) | function JSONReporter(runner) {
function clean (line 2902) | function clean(test) {
function errorJSON (line 2918) | function errorJSON(err) {
function Landing (line 2968) | function Landing(runner) {
function List (line 3046) | function List(runner) {
function Markdown (line 3115) | function Markdown(runner) {
function Min (line 3210) | function Min(runner) {
function NyanCat (line 3251) | function NyanCat(runner) {
function draw (line 3321) | function draw(type, n) {
function write (line 3489) | function write(string) {
function Progress (line 3524) | function Progress(runner, options) {
function Spec (line 3609) | function Spec(runner) {
function TAP (line 3691) | function TAP(runner) {
function title (line 3738) | function title(test) {
function XUnit (line 3778) | function XUnit(runner, options) {
function tag (line 3888) | function tag(name, attrs, close, content) {
function cdata (line 3910) | function cdata(str) {
function Runnable (line 3961) | function Runnable(title, fn) {
function multiple (line 4139) | function multiple(err) {
function done (line 4148) | function done(err) {
function callFn (line 4201) | function callFn(fn) {
function callFnAsync (line 4221) | function callFnAsync(fn) {
function Runner (line 4302) | function Runner(suite, delay) {
function next (line 4520) | function next(i) {
function next (line 4576) | function next(suite) {
function hookErr (line 4679) | function hookErr(_, errSuite, after) {
function next (line 4705) | function next(err, errSuite) {
function next (line 4820) | function next(errSuite) {
function done (line 4854) | function done(errSuite) {
function uncaught (line 4966) | function uncaught(err) {
function start (line 4970) | function start() {
function filterLeaks (line 5024) | function filterLeaks(ok, globals) {
function extraGlobals (line 5065) | function extraGlobals() {
function Suite (line 5129) | function Suite(title, parentContext) {
function Test (line 5471) | function Test(title, fn) {
function ignored (line 5691) | function ignored(path) {
function highlight (line 5795) | function highlight(js) {
function emptyRepresentation (line 5834) | function emptyRepresentation(value, type) {
function jsonStringify (line 5928) | function jsonStringify(object, spaces, depth) {
function withStack (line 6032) | function withStack(value, fn) {
function isMochaInternal (line 6186) | function isMochaInternal(line) {
function isNodeInternal (line 6193) | function isNodeInternal(line) {
function BrowserStdout (line 6234) | function BrowserStdout(opts) {
function Bar (line 6304) | function Bar () {}
function kMaxLength (line 6318) | function kMaxLength () {
function Buffer (line 6336) | function Buffer (arg) {
function fromNumber (line 6360) | function fromNumber (that, length) {
function fromString (line 6370) | function fromString (that, string, encoding) {
function fromObject (line 6381) | function fromObject (that, object) {
function fromBuffer (line 6404) | function fromBuffer (that, buffer) {
function fromArray (line 6411) | function fromArray (that, array) {
function fromTypedArray (line 6421) | function fromTypedArray (that, array) {
function fromArrayBuffer (line 6433) | function fromArrayBuffer (that, array) {
function fromArrayLike (line 6445) | function fromArrayLike (that, array) {
function fromJsonObject (line 6456) | function fromJsonObject (that, object) {
function allocate (line 6472) | function allocate (that, length) {
function checked (line 6488) | function checked (length) {
function SlowBuffer (line 6498) | function SlowBuffer (subject, encoding) {
function byteLength (line 6582) | function byteLength (string, encoding) {
function slowToString (line 6623) | function slowToString (encoding, start, end) {
function arrayIndexOf (line 6720) | function arrayIndexOf (arr, val, byteOffset) {
function hexWrite (line 6748) | function hexWrite (buf, string, offset, length) {
function utf8Write (line 6775) | function utf8Write (buf, string, offset, length) {
function asciiWrite (line 6779) | function asciiWrite (buf, string, offset, length) {
function binaryWrite (line 6783) | function binaryWrite (buf, string, offset, length) {
function base64Write (line 6787) | function base64Write (buf, string, offset, length) {
function ucs2Write (line 6791) | function ucs2Write (buf, string, offset, length) {
function base64Slice (line 6874) | function base64Slice (buf, start, end) {
function utf8Slice (line 6882) | function utf8Slice (buf, start, end) {
function decodeCodePointsArray (line 6960) | function decodeCodePointsArray (codePoints) {
function asciiSlice (line 6978) | function asciiSlice (buf, start, end) {
function binarySlice (line 6988) | function binarySlice (buf, start, end) {
function hexSlice (line 6998) | function hexSlice (buf, start, end) {
function utf16leSlice (line 7011) | function utf16leSlice (buf, start, end) {
function checkOffset (line 7060) | function checkOffset (offset, ext, length) {
function checkInt (line 7221) | function checkInt (buf, value, offset, ext, max, min) {
function objectWriteUInt16 (line 7268) | function objectWriteUInt16 (buf, value, offset, littleEndian) {
function objectWriteUInt32 (line 7302) | function objectWriteUInt32 (buf, value, offset, littleEndian) {
function checkIEEE754 (line 7446) | function checkIEEE754 (buf, value, offset, ext, max, min) {
function writeFloat (line 7452) | function writeFloat (buf, value, offset, littleEndian, noAssert) {
function writeDouble (line 7468) | function writeDouble (buf, value, offset, littleEndian, noAssert) {
function base64clean (line 7653) | function base64clean (str) {
function stringtrim (line 7665) | function stringtrim (str) {
function toHex (line 7670) | function toHex (n) {
function utf8ToBytes (line 7675) | function utf8ToBytes (string, units) {
function asciiToBytes (line 7755) | function asciiToBytes (str) {
function utf16leToBytes (line 7764) | function utf16leToBytes (str, units) {
function base64ToBytes (line 7780) | function base64ToBytes (str) {
function blitBuffer (line 7784) | function blitBuffer (src, dst, offset, length) {
function decode (line 7810) | function decode (elt) {
function b64ToByteArray (line 7828) | function b64ToByteArray (b64) {
function uint8ToBase64 (line 7874) | function uint8ToBase64 (uint8) {
function EventEmitter (line 8061) | function EventEmitter() {
function g (line 8203) | function g() {
function isFunction (line 8326) | function isFunction(arg) {
function isNumber (line 8330) | function isNumber(arg) {
function isObject (line 8334) | function isObject(arg) {
function isUndefined (line 8338) | function isUndefined(arg) {
function cleanUpNextTick (line 8428) | function cleanUpNextTick() {
function drainQueue (line 8440) | function drainQueue() {
function Item (line 8478) | function Item(fun, array) {
function noop (line 8492) | function noop() {}
function Duplex (line 8569) | function Duplex(options) {
function onend (line 8590) | function onend() {
function forEach (line 8601) | function forEach (xs, f) {
function PassThrough (line 8645) | function PassThrough(options) {
function ReadableState (line 8722) | function ReadableState(options, stream) {
function Readable (line 8790) | function Readable(options) {
function readableAddChunk (line 8828) | function readableAddChunk(stream, state, chunk, encoding, addToFront) {
function needMoreData (line 8884) | function needMoreData(state) {
function roundUpToNextPowerOf2 (line 8902) | function roundUpToNextPowerOf2(n) {
function howMuchToRead (line 8914) | function howMuchToRead(n, state) {
function chunkInvalid (line 9067) | function chunkInvalid(state, chunk) {
function onEofChunk (line 9079) | function onEofChunk(stream, state) {
function emitReadable (line 9096) | function emitReadable(stream) {
function emitReadable_ (line 9111) | function emitReadable_(stream) {
function maybeReadMore (line 9124) | function maybeReadMore(stream, state) {
function maybeReadMore_ (line 9133) | function maybeReadMore_(stream, state) {
function onunpipe (line 9185) | function onunpipe(readable) {
function onend (line 9192) | function onend() {
function cleanup (line 9204) | function cleanup() {
function ondata (line 9227) | function ondata(chunk) {
function onerror (line 9240) | function onerror(er) {
function onclose (line 9259) | function onclose() {
function onfinish (line 9264) | function onfinish() {
function unpipe (line 9271) | function unpipe() {
function pipeOnDrain (line 9288) | function pipeOnDrain(src) {
function resume (line 9406) | function resume(stream, state) {
function resume_ (line 9415) | function resume_(stream, state) {
function flow (line 9433) | function flow(stream) {
function fromList (line 9512) | function fromList(n, state) {
function endReadable (line 9576) | function endReadable(stream) {
function forEach (line 9597) | function forEach (xs, f) {
function indexOf (line 9603) | function indexOf (xs, x) {
function TransformState (line 9688) | function TransformState(options, stream) {
function afterTransform (line 9699) | function afterTransform(stream, er, data) {
function Transform (line 9725) | function Transform(options) {
function done (line 9804) | function done(stream, er) {
function WriteReq (line 9867) | function WriteReq(chunk, encoding, cb) {
function WritableState (line 9873) | function WritableState(options, stream) {
function Writable (line 9961) | function Writable(options) {
function writeAfterEnd (line 9983) | function writeAfterEnd(stream, state, cb) {
function validChunk (line 9997) | function validChunk(stream, state, chunk, cb) {
function decodeChunk (line 10061) | function decodeChunk(state, chunk, encoding) {
function writeOrBuffer (line 10073) | function writeOrBuffer(stream, state, chunk, encoding, cb) {
function doWrite (line 10094) | function doWrite(stream, state, writev, len, chunk, encoding, cb) {
function onwriteError (line 10106) | function onwriteError(stream, state, sync, er, cb) {
function onwriteStateUpdate (line 10121) | function onwriteStateUpdate(state) {
function onwrite (line 10128) | function onwrite(stream, er) {
function afterWrite (line 10158) | function afterWrite(stream, state, finished, cb) {
function onwriteDrain (line 10169) | function onwriteDrain(stream, state) {
function clearBuffer (line 10178) | function clearBuffer(stream, state) {
function needFinish (line 10263) | function needFinish(stream, state) {
function prefinish (line 10270) | function prefinish(stream, state) {
function finishMaybe (line 10277) | function finishMaybe(stream, state) {
function endWritable (line 10290) | function endWritable(stream, state, cb) {
function isArray (line 10328) | function isArray(ar) {
function isBoolean (line 10333) | function isBoolean(arg) {
function isNull (line 10338) | function isNull(arg) {
function isNullOrUndefined (line 10343) | function isNullOrUndefined(arg) {
function isNumber (line 10348) | function isNumber(arg) {
function isString (line 10353) | function isString(arg) {
function isSymbol (line 10358) | function isSymbol(arg) {
function isUndefined (line 10363) | function isUndefined(arg) {
function isRegExp (line 10368) | function isRegExp(re) {
function isObject (line 10373) | function isObject(arg) {
function isDate (line 10378) | function isDate(d) {
function isError (line 10383) | function isError(e) {
function isFunction (line 10389) | function isFunction(arg) {
function isPrimitive (line 10394) | function isPrimitive(arg) {
function isBuffer (line 10404) | function isBuffer(arg) {
function objectToString (line 10409) | function objectToString(o) {
function Stream (line 10473) | function Stream() {
function ondata (line 10480) | function ondata(chunk) {
function ondrain (line 10490) | function ondrain() {
function onend (line 10506) | function onend() {
function onclose (line 10514) | function onclose() {
function onerror (line 10522) | function onerror(er) {
function cleanup (line 10533) | function cleanup() {
function assertEncoding (line 10593) | function assertEncoding(encoding) {
function passThroughWrite (line 10769) | function passThroughWrite(buffer) {
function utf16DetectIncompleteChar (line 10773) | function utf16DetectIncompleteChar(buffer) {
function base64DetectIncompleteChar (line 10778) | function base64DetectIncompleteChar(buffer) {
function deprecated (line 10869) | function deprecated() {
function inspect (line 10916) | function inspect(obj, opts) {
function stylizeWithColor (line 10974) | function stylizeWithColor(str, styleType) {
function stylizeNoColor (line 10986) | function stylizeNoColor(str, styleType) {
function arrayToHash (line 10991) | function arrayToHash(array) {
function formatValue (line 11002) | function formatValue(ctx, value, recurseTimes) {
function formatPrimitive (line 11115) | function formatPrimitive(ctx, value) {
function formatError (line 11134) | function formatError(value) {
function formatArray (line 11139) | function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
function formatProperty (line 11159) | function formatProperty(ctx, value, recurseTimes, visibleKeys, key, arra...
function reduceToSingleString (line 11218) | function reduceToSingleString(output, base, braces) {
function isArray (line 11241) | function isArray(ar) {
function isBoolean (line 11246) | function isBoolean(arg) {
function isNull (line 11251) | function isNull(arg) {
function isNullOrUndefined (line 11256) | function isNullOrUndefined(arg) {
function isNumber (line 11261) | function isNumber(arg) {
function isString (line 11266) | function isString(arg) {
function isSymbol (line 11271) | function isSymbol(arg) {
function isUndefined (line 11276) | function isUndefined(arg) {
function isRegExp (line 11281) | function isRegExp(re) {
function isObject (line 11286) | function isObject(arg) {
function isDate (line 11291) | function isDate(d) {
function isError (line 11296) | function isError(e) {
function isFunction (line 11302) | function isFunction(arg) {
function isPrimitive (line 11307) | function isPrimitive(arg) {
function objectToString (line 11319) | function objectToString(o) {
function pad (line 11324) | function pad(n) {
function timestamp (line 11333) | function timestamp() {
function hasOwnProperty (line 11375) | function hasOwnProperty(obj, prop) {
function map (line 11401) | function map(arr, mapper, that) {
function clonePath (line 11413) | function clonePath(path) {
function removeEmpty (line 11416) | function removeEmpty(array) {
function escapeHTML (line 11425) | function escapeHTML(s) {
function canonicalize (line 11437) | function canonicalize(obj, stack, replacementStack) {
function buildValues (line 11482) | function buildValues(components, newString, oldString, useLongestToken) {
function Diff (line 11526) | function Diff(ignoreWhitespace) {
function done (line 11533) | function done(value) {
function execEditLength (line 11569) | function execEditLength() {
function contextLines (line 11796) | function contextLines(lines) {
function eofNL (line 11801) | function eofNL(curRange, i, current) {
function which (line 12030) | function which(name) {
function growl (line 12159) | function growl(msg, options, fn) {
function timeslice (line 12323) | function timeslice() {
FILE: test/old/performance.js
function perf (line 3) | function perf(fn, i){
FILE: test/old/tmp.js
function Next (line 24) | function Next(){
FILE: test/panic/1putackget.js
function wire (line 153) | function wire(){ // for the future tests, track how many wire messages a...
FILE: test/panic/3puts.js
function go (line 136) | function go(i){
FILE: test/panic/axe/5mob.js
function end (line 181) | function end(){
FILE: test/panic/axe/load_balance.js
function done (line 109) | function done(v,k) {
function onlyUnique (line 121) | function onlyUnique(value, index, self) { return self.indexOf(value) ===...
FILE: test/panic/bulkimport.js
function go (line 109) | function go(i){
FILE: test/panic/chat-user.js
function load (line 126) | function load(src, cb){
function gen (line 170) | function gen(){
FILE: test/panic/chat.js
function gen (line 156) | function gen(){
FILE: test/panic/e2e/distributed.js
function min (line 37) | function min(n, done, list){
function gunify (line 51) | function gunify(done, ctx){
FILE: test/panic/e2e/holy/grail.js
function open (line 16) | function open(url) {
function waitFor (line 53) | function waitFor (num, list) {
FILE: test/panic/livestream.js
function load (line 95) | function load(src, cb){
FILE: test/panic/radisk.js
function save (line 93) | function save(i){
function burst (line 124) | function burst(){
function check (line 185) | function check(i){
function burst (line 210) | function burst(){
function check (line 237) | function check(i){
function burst (line 257) | function burst(){
FILE: test/panic/set.js
function load (line 78) | function load(src, cb){
FILE: test/panic/speak.js
function load (line 107) | function load(src, cb){
function run (line 221) | function run(i){
function check (line 255) | function check(data){
function end (line 277) | function end(){
FILE: test/panic/thread.js
function load (line 77) | function load(src, cb){
function start (line 142) | async function start(){
FILE: test/panic/user-paste.js
function load (line 106) | function load(src, cb){
FILE: test/panic/users.js
function load (line 78) | function load(src, cb){
FILE: test/panic/util/load-browser-scripts.js
function load (line 16) | function load(src, cb) {
function loadAll (line 22) | function loadAll(src, cb) {
FILE: test/panic/who.js
function load (line 78) | function load(src, cb){
function load (line 177) | function load(src, cb){
FILE: test/ptsd/benchmark.js
function ctor (line 257) | function ctor() { this.x = 1; }
function Benchmark (line 404) | function Benchmark(name, fn, options) {
function Deferred (line 445) | function Deferred(clone) {
function Event (line 461) | function Event(type) {
function Suite (line 507) | function Suite(name, options) {
function concat (line 556) | function concat() {
function insert (line 587) | function insert(start, deleteCount, elements) {
function reverse (line 638) | function reverse() {
function shift (line 671) | function shift() {
function slice (line 684) | function slice(start, end) {
function splice (line 714) | function splice(start, deleteCount) {
function toInteger (line 738) | function toInteger(value) {
function unshift (line 749) | function unshift() {
function bind (line 765) | function bind(fn, thisArg) {
function createFunction (line 777) | function createFunction() {
function delay (line 802) | function delay(bench, fn) {
function destroyElement (line 812) | function destroyElement(element) {
function forProps (line 827) | function forProps() {
function getFirstArgument (line 943) | function getFirstArgument(fn) {
function getMean (line 955) | function getMean(sample) {
function getSource (line 969) | function getSource(fn, altSource) {
function isArguments (line 993) | function isArguments() {
function isClassOf (line 1015) | function isClassOf(value, name) {
function isHostType (line 1029) | function isHostType(object, property) {
function isPlainObject (line 1044) | function isPlainObject(value) {
function isStringable (line 1084) | function isStringable(value) {
function methodize (line 1096) | function methodize(fn) {
function noop (line 1109) | function noop() {
function req (line 1120) | function req(id) {
function runScript (line 1133) | function runScript(code) {
function setOptions (line 1165) | function setOptions(bench, options) {
function resolve (line 1188) | function resolve() {
function deepClone (line 1225) | function deepClone(value) {
function each (line 1400) | function each(object, callback, thisArg) {
function extend (line 1446) | function extend(destination, source) {
function filter (line 1485) | function filter(array, callback, thisArg) {
function forEach (line 1518) | function forEach(array, callback, thisArg) {
function forOwn (line 1545) | function forOwn(object, callback, thisArg) {
function formatNumber (line 1557) | function formatNumber(number) {
function hasKey (line 1572) | function hasKey() {
function indexOf (line 1608) | function indexOf(array, value, fromIndex) {
function interpolate (line 1630) | function interpolate(string, object) {
function invoke (line 1677) | function invoke(benches, name) {
function join (line 1831) | function join(object, separator1, separator2) {
function map (line 1853) | function map(array, callback, thisArg) {
function pluck (line 1869) | function pluck(array, property) {
function reduce (line 1885) | function reduce(array, callback, accumulator) {
function abortSuite (line 1902) | function abortSuite() {
function add (line 1962) | function add(name, fn, options) {
function cloneSuite (line 1981) | function cloneSuite(options) {
function filterSuite (line 2004) | function filterSuite(callback) {
function resetSuite (line 2019) | function resetSuite() {
function runSuite (line 2056) | function runSuite(options) {
function emit (line 2095) | function emit(type) {
function listeners (line 2125) | function listeners(type) {
function off (line 2158) | function off(type, listener) {
function on (line 2197) | function on(type, listener) {
function abort (line 2218) | function abort() {
function clone (line 2257) | function clone(options) {
function compare (line 2280) | function compare(other) {
function reset (line 2334) | function reset() {
function toStringBench (line 2405) | function toStringBench() {
function clock (line 2433) | function clock() {
function compute (line 2735) | function compute(bench, options) {
function cycle (line 2889) | function cycle(clone, options) {
function run (line 3000) | function run(options) {
FILE: test/ptsd/memdisk.js
function it (line 19) | function it(i){
FILE: test/ptsd/perf.js
function fn (line 65) | function fn(){}
function Thing (line 67) | function Thing(){
function CHAIN (line 83) | function CHAIN(){}
function CHAIN2 (line 90) | function CHAIN2(){}
function CHAIN3 (line 97) | function CHAIN3(){}
function CHAIN4 (line 114) | function CHAIN4(){
function noop (line 135) | function noop(){}
function CHAIN5 (line 136) | function CHAIN5(){
function noop (line 166) | function noop(){}
function CHAIN6 (line 167) | function CHAIN6(){
function noop (line 197) | function noop(){}
function CHAIN7 (line 198) | function CHAIN7(){
function noop (line 232) | function noop(){}
function CHAIN8 (line 233) | function CHAIN8(){
function noop (line 274) | function noop(){}
function CHAIN9 (line 275) | function CHAIN9(){
function PUT (line 304) | function PUT(){ this.data = u; this.state = u; }
function noop (line 313) | function noop(){}
function CHAINA1 (line 314) | function CHAINA1(){
function noop (line 362) | function noop(){}
function CHAINA2 (line 363) | function CHAINA2(){
function noop (line 414) | function noop(){}
function CHAINA3 (line 415) | function CHAINA3(){
function noop (line 473) | function noop(){}
function CHAINA3A (line 474) | function CHAINA3A(){
function noop (line 534) | function noop(){}
function CHAINA3B (line 535) | function CHAINA3B(){
function noop (line 595) | function noop(){}
function CHAINA3C (line 596) | function CHAINA3C(o){
function noop (line 661) | function noop(){}
function CHAINA3D (line 662) | function CHAINA3D(o){
function noop (line 729) | function noop(){}
function CHAINA3E (line 730) | function CHAINA3E(o){
function noop (line 814) | function noop(){}
function CHAINA3F (line 815) | function CHAINA3F(o){
function noop (line 917) | function noop(){}
function CHAINA4 (line 918) | function CHAINA4(o){
function get (line 962) | function get(err, node){
function get (line 981) | function get(err, node){
function on (line 987) | function on(cat){
function on (line 1021) | function on(cat){
function noop (line 1035) | function noop(){}
function CHAINA5 (line 1036) | function CHAINA5(o){
function get (line 1065) | function get(err, node){
function get (line 1084) | function get(err, node){
function on (line 1090) | function on(cat){
function on (line 1124) | function on(cat){
function noop (line 1138) | function noop(){}
function CHAINA6 (line 1139) | function CHAINA6(o){
function get (line 1168) | function get(err, node){
function get (line 1187) | function get(err, node){
function on (line 1193) | function on(cat){
function on (line 1227) | function on(cat){
function noop (line 1241) | function noop(){}
function CHAINA7 (line 1242) | function CHAINA7(o){
function get (line 1271) | function get(err, node){
function get (line 1290) | function get(err, node){
function on (line 1296) | function on(cat){
function map (line 1330) | function map(node, soul){
function ify (line 1333) | function ify(err, env){
function on (line 1337) | function on(cat){
function Scope (line 1352) | function Scope(){
function emit (line 1360) | function emit(a){
function event (line 1366) | function event(fn){
function At (line 1372) | function At(fn, tag, s){
function noop (line 1380) | function noop(){}
function CHAINA8 (line 1381) | function CHAINA8(o){
function get (line 1410) | function get(err, node){
function get (line 1429) | function get(err, node){
function on (line 1435) | function on(cat){
function map (line 1470) | function map(node, soul){
function ify (line 1473) | function ify(err, env){
function wrap (line 1477) | function wrap(cat, data){
function on (line 1489) | function on(cat){
function noop (line 1504) | function noop(){}
function CHAINA9 (line 1505) | function CHAINA9(o){
function get (line 1534) | function get(err, node){
function get (line 1553) | function get(err, node){
function on (line 1559) | function on(cat){
function wrap (line 1594) | function wrap(cat, data){
function on (line 1606) | function on(cat){ var at = cat, state = Gun.time.is();
function ack (line 1620) | function ack(err, ok){
function end (line 1623) | function end(err, env){
function noop (line 1638) | function noop(){}
function CHAINB1 (line 1639) | function CHAINB1(o){
function get (line 1671) | function get(err, node){
function got (line 1689) | function got(err, node){
function run (line 1696) | function run(cat){
function wrap (line 1734) | function wrap(cat, data){
function run (line 1746) | function run(cat){ var at = cat, state = Gun.time.is();
function ack (line 1760) | function ack(err, ok){
function end (line 1763) | function end(err, env){
function run (line 1777) | function run(cat){
function noop (line 1794) | function noop(){}
function CHAINB2 (line 1795) | function CHAINB2(o){
function get (line 1827) | function get(err, node){
function got (line 1845) | function got(err, node){
function run (line 1852) | function run(cat){
function wrap (line 1890) | function wrap(cat, data){
function run (line 1902) | function run(cat){ var at = cat, state = Gun.time.is();
function ack (line 1921) | function ack(err, ok){
function end (line 1924) | function end(err, env){
function run (line 1938) | function run(cat){
function gun_get (line 1955) | function gun_get(soul){
FILE: test/ptsd/ptsd.js
function abort (line 6) | function abort() {
function clear (line 19) | function clear() {
function run (line 29) | function run() {
function add (line 71) | function add(title, code) {
function setup (line 103) | function setup(code){
function share (line 110) | function share() {
function parse (line 144) | function parse(id) {
FILE: test/ptsd/spam.js
function save (line 10) | function save(i){
function burst (line 17) | function burst(){
FILE: test/ptsd/streampipe.js
class Generator (line 15) | class Generator extends stream.Readable {
method constructor (line 16) | constructor(n) {
method _read (line 23) | _read(size) {
class Line (line 42) | class Line extends stream.Transform {
method constructor (line 43) | constructor() {
method trySendLine (line 48) | trySendLine() {
method _transform (line 61) | _transform(chunk, enc, cb) {
method end (line 69) | end() {
class Graph (line 80) | class Graph extends stream.Transform {
method constructor (line 81) | constructor() {
method _transform (line 91) | _transform(chunk, enc, cb) {
class Report (line 113) | class Report extends stream.Transform {
method constructor (line 114) | constructor() {
method _transform (line 119) | _transform(chunk, enc, cb) {
FILE: test/rad/bench.js
function spam (line 19) | function spam(){
FILE: test/rad/book.js
function gen (line 298) | function gen(val){ return val + String.random(99,'a') }
FILE: test/rad/rad.book.spec.js
constant ENABLE_GUN_LOGGING (line 13) | const ENABLE_GUN_LOGGING = false;
constant PATH_TO_TEST_FOLDER (line 15) | const PATH_TO_TEST_FOLDER = path.resolve(__dirname, 'booktestdata');
constant PATH_TO_OLD_DB (line 16) | const PATH_TO_OLD_DB = path.resolve(PATH_TO_TEST_FOLDER, 'oldradata');
constant PATH_TO_TEST_DB (line 17) | const PATH_TO_TEST_DB = path.resolve(PATH_TO_TEST_FOLDER, 'radatatest');
constant PATH_TO_TEST_DB2 (line 18) | const PATH_TO_TEST_DB2 = path.resolve(PATH_TO_TEST_FOLDER, 'radatatest2');
constant BOOK_SPECIAL_CHARS (line 25) | const BOOK_SPECIAL_CHARS = ['\'|', '|\'', '|', '\'', '\n'];
constant BOOK_PAGE_SIZE (line 26) | const BOOK_PAGE_SIZE = 3000;
constant RAD_PATH_SEPARATORS (line 28) | const RAD_PATH_SEPARATORS = ['/', '.'];
constant GUN_PRIMITIVES (line 29) | const GUN_PRIMITIVES = [
constant RE_UNPRINTABLE (line 81) | const RE_UNPRINTABLE = /[^\x20-\x7E]/;
constant RE_APOSTROPHES (line 82) | const RE_APOSTROPHES = /'/g;
constant SKIP_CHARS (line 84) | const SKIP_CHARS = false;
constant CHAR_MAX (line 85) | const CHAR_MAX = 330;
constant UNPRINTABLE_MAX (line 86) | const UNPRINTABLE_MAX = 128;
constant DATA_LENGTHS (line 88) | const DATA_LENGTHS = [
constant LONG_DATAS (line 99) | const LONG_DATAS = DATA_LENGTHS.map(l => ''.padEnd(l, '012345'));
constant ALL_CHARS (line 101) | const ALL_CHARS = [];
constant PRINTABLE_CHARS (line 106) | const PRINTABLE_CHARS = ALL_CHARS.filter(c => !RE_UNPRINTABLE.test(c));
constant UNPRINTABLE_CHARS (line 107) | const UNPRINTABLE_CHARS = ALL_CHARS.filter(c => RE_UNPRINTABLE.test(c))....
constant ESCAPE_CHARS (line 108) | const ESCAPE_CHARS = [`\0`, `\u001b`, `\\`, `\\\\`, `\\\\\\`, `\\\\\\\\`];
constant NORMAL_CHARS (line 109) | const NORMAL_CHARS = ['A', 'B', 'C'];
constant ESCAPE_FACTORIES (line 111) | const ESCAPE_FACTORIES = {
function buildSoul (line 124) | function buildSoul(separator, ...args) {
constant SOUL_GAUNTLET (line 128) | const SOUL_GAUNTLET = RAD_PATH_SEPARATORS
function getValueFromPage (line 324) | function getValueFromPage(soul, res) {
function findInList (line 338) | function findInList(list, word) {
function testDirExists (line 343) | function testDirExists() {
function unpersist (line 347) | function unpersist(opt) {
function buildRad (line 353) | function buildRad(opt) {
FILE: test/rad/rad.js
function next (line 453) | function next(){
FILE: test/sea/nodeauth.js
constant SEA (line 2) | const SEA = require("../../sea.js");
FILE: test/sea/sea.js
function A (line 439) | function A(){
function check (line 519) | function check(){
FILE: test/tmp/mitra/gun_https2.js
function hijack (line 38) | function hijack(cb) {
FILE: types/gun/GunCallbackGet.d.ts
type GunMessageGet (line 4) | type GunMessageGet<
type GunCallbackGet (line 15) | type GunCallbackGet<
FILE: types/gun/GunCallbackMap.d.ts
type GunCallbackMap (line 3) | type GunCallbackMap<
FILE: types/gun/GunCallbackOn.d.ts
type GunCallbackOn (line 3) | type GunCallbackOn<V extends GunSchema, K extends string> = (
FILE: types/gun/GunCallbackOnce.d.ts
type GunCallbackOnce (line 3) | type GunCallbackOnce<V extends GunSchema, K extends string> = (
FILE: types/gun/GunCallbackPut.d.ts
type GunMessagePut (line 1) | type GunMessagePut =
type GunCallbackPut (line 11) | type GunCallbackPut = (ack: GunMessagePut) => void;
FILE: types/gun/GunDataNode.d.ts
type GunDataNode (line 3) | type GunDataNode<T extends GunSchema> = T extends GunSchema & object
FILE: types/gun/GunHookCallbackBye.d.ts
type GunHookCallbackBye (line 3) | type GunHookCallbackBye = (
FILE: types/gun/GunHookCallbackCreate.d.ts
type GunHookCallbackCreate (line 3) | type GunHookCallbackCreate = (
FILE: types/gun/GunHookCallbackGet.d.ts
type GunHookMessageGet (line 3) | type GunHookMessageGet<MessageExtension extends pany> = {
type GunHookCallackGet (line 9) | type GunHookCallackGet<MessageExtension extends pany> = (
FILE: types/gun/GunHookCallbackHi.d.ts
type GunHookCallbackHi (line 3) | type GunHookCallbackHi = (
FILE: types/gun/GunHookCallbackIn.d.ts
type GunHookMessageIn (line 3) | type GunHookMessageIn<
type GunHookCallbackIn (line 13) | type GunHookCallbackIn<
FILE: types/gun/GunHookCallbackOpt.d.ts
type GunHookCallbackOpt (line 3) | type GunHookCallbackOpt = (this: IGunHookContext<_GunRoot>, root: _GunRo...
FILE: types/gun/GunHookCallbackOut.d.ts
type GunHookMessageOut (line 3) | type GunHookMessageOut<
type GunHookCallbackOut (line 13) | type GunHookCallbackOut<
FILE: types/gun/GunHookCallbackPut.d.ts
type GunHookMessagePut (line 3) | type GunHookMessagePut = {
type GunHookCallbackPut (line 9) | type GunHookCallbackPut = (
FILE: types/gun/GunNodeGet.d.ts
type GunNodeGet (line 1) | type GunNodeGet = {
FILE: types/gun/GunNodePut.d.ts
type GunNodePut (line 3) | type GunNodePut = GunNodeGet & {
FILE: types/gun/GunOptions.d.ts
type GunOptions (line 1) | type GunOptions =
FILE: types/gun/GunOptionsOn.d.ts
type GunOptionsOn (line 1) | type GunOptionsOn = Partial<
FILE: types/gun/GunOptionsOnce.d.ts
type GunOptionsOnce (line 1) | type GunOptionsOnce = Partial<{
FILE: types/gun/GunOptionsPut.d.ts
type GunOptionsPut (line 1) | type GunOptionsPut = Partial<{
FILE: types/gun/GunPeer.d.ts
type GunPeer (line 1) | type GunPeer = {
FILE: types/gun/GunSchema.d.ts
type IGunSchema (line 3) | interface IGunSchema {
type GunSchema (line 12) | type GunSchema =
FILE: types/gun/GunSoul.d.ts
type GunSoul (line 2) | type GunSoul<_N extends GunSchema, Soul extends string = string> = {
FILE: types/gun/GunValueSimple.d.ts
type GunValueSimple (line 1) | type GunValueSimple = string | number | boolean | null;
FILE: types/gun/IGun.d.ts
type IGun (line 11) | interface IGun {
FILE: types/gun/IGunChain.d.ts
type IGunChain (line 19) | interface IGunChain<
FILE: types/gun/IGunHookContext.d.ts
type IGunHookContext (line 1) | interface IGunHookContext<T> {
FILE: types/gun/IGunInstance.d.ts
type IGunInstance (line 3) | interface IGunInstance<TNode extends Record<string, GunSchema> = any>
FILE: types/gun/IGunInstanceHookHandler.d.ts
type IGunInstanceHookHandler (line 12) | interface IGunInstanceHookHandler {
FILE: types/gun/IGunInstanceRoot.d.ts
type IGunInstanceRoot (line 15) | interface IGunInstanceRoot<
FILE: types/gun/IGunMeta.d.ts
type IGunMeta (line 1) | interface IGunMeta<T extends object> {
FILE: types/gun/IGunOnEvent.d.ts
type IGunOnEvent (line 1) | interface IGunOnEvent {
FILE: types/gun/LEX.d.ts
type LEX (line 1) | type LEX<T extends string = string> = {
FILE: types/gun/LEXQuery.d.ts
type LEXQuery (line 3) | type LEXQuery<T extends string = string> = { '.': LEX<T>; ':'?: number };
FILE: types/gun/_GunRoot.d.ts
type _GunRoot (line 3) | interface _GunRoot extends IGunInstanceHookHandler {
FILE: types/gun/pany.d.ts
type pany (line 1) | type pany = Partial<any>;
FILE: types/sea/GunCallbackUserAuth.d.ts
type GunCallbackUserAuth (line 3) | type GunCallbackUserAuth = (
FILE: types/sea/GunCallbackUserCreate.d.ts
type GunCallbackUserCreate (line 1) | type GunCallbackUserCreate = (
FILE: types/sea/GunHookCallbackAuth.d.ts
type GunHookCallbackAuth (line 3) | type GunHookCallbackAuth = (
FILE: types/sea/GunUser.d.ts
type GunUser (line 1) | type GunUser = {
FILE: types/sea/IGun.d.ts
type IGun (line 5) | interface IGun {
FILE: types/sea/IGunInstance.d.ts
type IGunInstance (line 5) | interface IGunInstance<TNode> {
FILE: types/sea/IGunInstanceHookHandler.d.ts
type IGunInstanceHookHandler (line 5) | interface IGunInstanceHookHandler {
FILE: types/sea/IGunInstanceRoot.d.ts
type IGunInstanceRoot (line 5) | interface IGunInstanceRoot<TNode, TGunInstance> {
FILE: types/sea/IGunUserInstance.d.ts
type IGunUserInstance (line 12) | interface IGunUserInstance<
FILE: types/sea/IPolicy.d.ts
type IPolicy (line 3) | interface IPolicy extends LEX {
FILE: types/sea/ISEA.d.ts
type ISEA (line 6) | interface ISEA {
FILE: types/sea/ISEAPair.d.ts
type ISEAPair (line 1) | interface ISEAPair {
FILE: types/sea/OptionsUserAuth.d.ts
type OptionsUserAuth (line 1) | type OptionsUserAuth = { change: string };
FILE: types/sea/OptionsUserRecall.d.ts
type OptionsUserRecall (line 1) | type OptionsUserRecall = { sessionStorage: boolean };
FILE: types/sea/Policy.d.ts
type Policy (line 3) | type Policy = string | IPolicy | (string | IPolicy)[];
FILE: types/test/gun-instance.test-d.ts
method uuid (line 12) | uuid() {
FILE: types/test/gun-on.test-d.ts
type TOnlinable (line 3) | type TOnlinable = { online: boolean };
FILE: types/test/gun-put.test-d.ts
type User (line 7) | type User = { name: string };
FILE: types/test/gun-set.test-d.ts
type User (line 3) | type User = { name: string };
FILE: types/test/sea-certify.test-d.ts
function certify (line 4) | async function certify() {
FILE: types/test/sea.test-d.ts
constant SEA (line 3) | const SEA = Gun.SEA;
FILE: types/utils.d.ts
type GunSoul2TNode (line 3) | type GunSoul2TNode<T> = T extends GunSoul<infer TNode, infer _Soul>
type GunSoul2Soul (line 7) | type GunSoul2Soul<T> = T extends GunSoul<infer _TNode, infer Soul>
type IGunChain2TNode (line 11) | type IGunChain2TNode<T> = T extends IGunChain<
type IGunInstanceRoot2TGunInstance (line 20) | type IGunInstanceRoot2TGunInstance<T> = T extends IGunInstanceRoot<
Condensed preview — 571 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4,129K chars).
[
{
"path": ".dockerignore",
"chars": 54,
"preview": "node_modules\nradata\nstats.radata\n.git\n.gitignore\n*.md\n"
},
{
"path": ".github/FUNDING.yml",
"chars": 559,
"preview": "# These are supported funding model platforms\n\ngithub: amark\npatreon: gunDB\nopen_collective: gun\nko_fi: # Replace with a"
},
{
"path": ".github/workflows/ci.yml",
"chars": 3250,
"preview": "name: ci\n\non:\n push:\n pull_request:\n\njobs:\n test:\n strategy:\n matrix:\n node-version: [14.x]\n os"
},
{
"path": ".gitignore",
"chars": 248,
"preview": "node_modules\r\nnpm-debug.log\r\nyarn.lock\r\n*data.json\r\n*data*\r\n*.db\r\n.idea/\r\n*.bak\r\n*.new\r\n*.log\r\nv8.json\r\n*.DS_store\r\nisol"
},
{
"path": ".npmignore",
"chars": 39,
"preview": "*.ts\n/temp/\n!*.d.ts\n*.radata\nisolate-*\n"
},
{
"path": ".prettierignore",
"chars": 1,
"preview": "*"
},
{
"path": ".travis.yml",
"chars": 123,
"preview": "language: node_js\nbranches:\n except:\n - debug\n - manhattan\nnode_js:\n - 10\ncache:\n directories:\n - node_modul"
},
{
"path": "CHANGELOG.md",
"chars": 5918,
"preview": "# CHANGELOG\n\n## 0.2020.x\n\n`>0.2020.520` may break in-process `gun1` `gun2` message passing. Check `test/common.js` \"Chec"
},
{
"path": "Dockerfile",
"chars": 974,
"preview": "# install packages\nFROM node:lts-alpine as builder\nRUN mkdir /work\nWORKDIR /work\nRUN apk add --no-cache alpine-sdk pytho"
},
{
"path": "LICENSE.md",
"chars": 2467,
"preview": "Copyright (c) 2015 Mark Nadal\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this soft"
},
{
"path": "Procfile",
"chars": 36,
"preview": "web: node --inspect examples/http.js"
},
{
"path": "README.md",
"chars": 21743,
"preview": "<p id=\"readme\"><a href=\"https://gun.eco/\"><img width=\"40%\" src=\"https://cldup.com/TEy9yGh45l.svg\"/></a><img width=\"50%\" "
},
{
"path": "RELEASE.md",
"chars": 537,
"preview": "Every push or pull request will\n\n - run the tests\n\nEvery push to master will\n\n - run the tests\n - publish the latest doc"
},
{
"path": "SECURITY.md",
"chars": 1935,
"preview": "# Security Policy\n\n## Introduction\n\nSecurity is our top priority. We are committed to ensuring that our project is as se"
},
{
"path": "app.json",
"chars": 601,
"preview": "{\n \"name\": \"gun-server\",\n \"website\": \"http://gun.eco/\",\n \"repository\": \"https://github.com/amark/gun\",\n \"logo\": \"htt"
},
{
"path": "as.js",
"chars": 6820,
"preview": ";(function(){\n\tfunction as(el, gun, cb, opt){\n\t\tel = $(el);\n\t\tif(gun === as.gui && as.el && as.el.is(el)){ return }\n\n\t\to"
},
{
"path": "axe.js",
"chars": 4094,
"preview": ";(function(){\n\n\tvar sT = setTimeout || {}, u;\n if(typeof window !== ''+u){ sT.window = window }\n\tvar AXE = (sT.window||"
},
{
"path": "bower.json",
"chars": 642,
"preview": "{\n \"name\": \"gun\",\n \"main\": \"gun.js\",\n \"version\": \"0.1.5\",\n \"homepage\": \"http://gunDB.io\",\n \"authors\": [\n { \"name"
},
{
"path": "browser.js",
"chars": 163,
"preview": "// if(!(typeof navigator == \"undefined\") && navigator.product == \"ReactNative\"){\r\n// require(\"./lib/mobile.js\");\r\n//"
},
{
"path": "examples/.gitignore",
"chars": 43,
"preview": "node_modules/*\r\nnpm-debug.log\r\n*data.json\r\n"
},
{
"path": "examples/Main.js",
"chars": 9035,
"preview": "import { render } from './iris/js/lib/preact.js';\nimport { Router, route } from './iris/js/lib/preact-router.es.js';\nimp"
},
{
"path": "examples/angular/.angular-cli.json",
"chars": 1164,
"preview": "{\n \"$schema\": \"./node_modules/@angular/cli/lib/config/schema.json\",\n \"project\": {\n \"name\": \"angular\"\n },\n \"apps\":"
},
{
"path": "examples/angular/.editorconfig",
"chars": 245,
"preview": "# Editor configuration, see http://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_style = space\nindent_size = "
},
{
"path": "examples/angular/.gitignore",
"chars": 516,
"preview": "# See http://help.github.com/ignore-files/ for more about ignoring files.\n\n# compiled output\n/dist\n/tmp\n/out-tsc\n\n# depe"
},
{
"path": "examples/angular/README.md",
"chars": 1077,
"preview": "# Angular\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.\n\n## Deve"
},
{
"path": "examples/angular/e2e/app.e2e-spec.ts",
"chars": 305,
"preview": "import { AngularPage } from './app.po';\n\ndescribe('angular App', () => {\n let page: AngularPage;\n\n beforeEach(() => {\n"
},
{
"path": "examples/angular/e2e/app.po.ts",
"chars": 212,
"preview": "import { browser, element, by } from 'protractor';\n\nexport class AngularPage {\n navigateTo() {\n return browser.get('"
},
{
"path": "examples/angular/e2e/tsconfig.e2e.json",
"chars": 193,
"preview": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../out-tsc/e2e\",\n \"module\": \"commonjs\",\n "
},
{
"path": "examples/angular/example_package.json",
"chars": 1375,
"preview": "{\n \"name\": \"angular\",\n \"version\": \"0.0.0\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"ng\": \"ng\",\n \"start\": \"ng serve\","
},
{
"path": "examples/angular/karma.conf.js",
"chars": 1240,
"preview": "// Karma configuration file, see link for more information\n// https://karma-runner.github.io/0.13/config/configuration-f"
},
{
"path": "examples/angular/protractor.conf.js",
"chars": 756,
"preview": "// Protractor configuration file, see link for more information\n// https://github.com/angular/protractor/blob/master/lib"
},
{
"path": "examples/angular/server.js",
"chars": 613,
"preview": "var port = process.env.OPENSHIFT_NODEJS_PORT || process.env.VCAP_APP_PORT || process.env.PORT || process.argv[2] || 8765"
},
{
"path": "examples/angular/src/app/app.component.css",
"chars": 271,
"preview": "html, body { font-size: 14pt; padding: 10px 2.5%;}\n.hide { display: none; }\nform .who { width: 10%; }\nform .what { width"
},
{
"path": "examples/angular/src/app/app.component.html",
"chars": 489,
"preview": "<div>\n\n <form (ngSubmit)=\"add()\">\n <input type=\"text\" [(ngModel)]=\"newTodo\" name=\"newTodo\" placeholder=\"New TODO\">\n "
},
{
"path": "examples/angular/src/app/app.component.spec.ts",
"chars": 1000,
"preview": "import { TestBed, async } from '@angular/core/testing';\n\nimport { AppComponent } from './app.component';\n\ndescribe('AppC"
},
{
"path": "examples/angular/src/app/app.component.ts",
"chars": 927,
"preview": "import { Component, OnInit } from '@angular/core';\nimport { Observable } from 'rxjs/Observable';\nimport { Subscription }"
},
{
"path": "examples/angular/src/app/app.module.ts",
"chars": 603,
"preview": "import { BrowserModule } from '@angular/platform-browser';\nimport { NgModule, Injectable } from '@angular/core';\nimport "
},
{
"path": "examples/angular/src/app/gun.helper.ts",
"chars": 998,
"preview": "import { Observable } from 'rxjs/Observable';\nimport { Gun } from 'gun/gun';\nimport { pick } from 'underscore';\n\nexport "
},
{
"path": "examples/angular/src/app/gun.service.ts",
"chars": 169,
"preview": "import { NgModule, Injectable } from '@angular/core';\nimport Gun from 'gun/gun';\n\n@Injectable()\nexport class GunDb {\n "
},
{
"path": "examples/angular/src/assets/.gitkeep",
"chars": 0,
"preview": ""
},
{
"path": "examples/angular/src/environments/environment.prod.ts",
"chars": 51,
"preview": "export const environment = {\n production: true\n};\n"
},
{
"path": "examples/angular/src/environments/environment.ts",
"chars": 387,
"preview": "// The file contents for the current environment will overwrite these during build.\n// The build system defaults to the "
},
{
"path": "examples/angular/src/index.html",
"chars": 294,
"preview": "<!doctype html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <title>Angular</title>\n <base href=\"/\">\n\n <meta name=\"viewpor"
},
{
"path": "examples/angular/src/main.ts",
"chars": 455,
"preview": "import { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynami"
},
{
"path": "examples/angular/src/polyfills.ts",
"chars": 2429,
"preview": "/**\n * This file includes polyfills needed by Angular and is loaded before the app.\n * You can add your own extra polyfi"
},
{
"path": "examples/angular/src/styles.css",
"chars": 80,
"preview": "/* You can add global styles to this file, and also import other style files */\n"
},
{
"path": "examples/angular/src/test.ts",
"chars": 1081,
"preview": "// This file is required by karma.conf.js and loads recursively all the .spec and framework files\n\nimport 'zone.js/dist/"
},
{
"path": "examples/angular/src/tsconfig.app.json",
"chars": 209,
"preview": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../out-tsc/app\",\n \"module\": \"es2015\",\n \"b"
},
{
"path": "examples/angular/src/tsconfig.spec.json",
"chars": 302,
"preview": "{\n \"extends\": \"../tsconfig.json\",\n \"compilerOptions\": {\n \"outDir\": \"../out-tsc/spec\",\n \"module\": \"commonjs\",\n "
},
{
"path": "examples/angular/src/typings.d.ts",
"chars": 104,
"preview": "/* SystemJS module definition */\ndeclare var module: NodeModule;\ninterface NodeModule {\n id: string;\n}\n"
},
{
"path": "examples/angular/tsconfig.json",
"chars": 385,
"preview": "{\n \"compileOnSave\": false,\n \"compilerOptions\": {\n \"outDir\": \"./dist/out-tsc\",\n \"baseUrl\": \"src\",\n \"sourceMap\""
},
{
"path": "examples/angular/tslint.json",
"chars": 2710,
"preview": "{\n \"rulesDirectory\": [\n \"node_modules/codelyzer\"\n ],\n \"rules\": {\n \"callable-types\": true,\n \"class-name\": tru"
},
{
"path": "examples/axe.html",
"chars": 1077,
"preview": "<!DOCTYPE HTML>\n<html>\n\n<head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n <meta name=\"vie"
},
{
"path": "examples/basic/chat.html",
"chars": 942,
"preview": "<!DOCTYPE html>\n<ul id='list'></ul>\n<form id='form'>\n <input id='who' placeholder='name'>\n <input id='what' placeholde"
},
{
"path": "examples/basic/emoji.html",
"chars": 70,
"preview": "<!DOCTYPE html>\n<p>Moved to <a href=\"./chat.html\">./chat.html</a>!</p>"
},
{
"path": "examples/basic/meet.html",
"chars": 1518,
"preview": "<!DOCTYPE html>\n\n<center>must press play or unmute on new videos to accept meeting</center>\n<center id=\"videos\">\n<video "
},
{
"path": "examples/basic/note.html",
"chars": 419,
"preview": "<!DOCTYPE html>\n<style>html, body, textarea { width: 100%; height: 100%; padding: 0; margin: 0; }</style>\n<textarea id=\""
},
{
"path": "examples/basic/paste.html",
"chars": 70,
"preview": "<!DOCTYPE html>\n<p>Moved to <a href=\"./note.html\">./note.html</a>!</p>"
},
{
"path": "examples/basic/poll.html",
"chars": 3666,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width\">\n\n\t<script s"
},
{
"path": "examples/basic/post.html",
"chars": 1206,
"preview": "<!DOCTYPE html>\n\n<h1>Posts</h1>\n\n<form id=\"sign\">\n <input id=\"alias\" placeholder=\"username\">\n <input id=\"pass\" type=\"p"
},
{
"path": "examples/basic/private.html",
"chars": 5883,
"preview": "<!DOCTYPE html>\n<style>\n html, body {\n background: rgb(245, 245, 245);\n margin: 0;\n padding: 0;\n }\n div {\n "
},
{
"path": "examples/basic/schedule.html",
"chars": 4289,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, user-scalable=0\">\n "
},
{
"path": "examples/basic/screen.html",
"chars": 1584,
"preview": "<!DOCTYPE html>\n\n<video id=\"video\" width=\"100%\"></video>\n<center>\n <button id=\"record\">Record</button>\n <button id=\"pl"
},
{
"path": "examples/basic/stream.html",
"chars": 3917,
"preview": "<!DOCTYPE html>\n\n<center>\n <img id=\"img\" width=\"100%\"><br/>\n Stream <select id=\"select\"><option id=\"from\">from</option"
},
{
"path": "examples/basic/tables.html",
"chars": 3335,
"preview": "<!DOCTYPE html>\n\n<h1>Tables</h1>\n\n<form id=\"sign\">\n <input id=\"alias\" placeholder=\"username\">\n <input id=\"pass\" type=\""
},
{
"path": "examples/basic/upload.html",
"chars": 1241,
"preview": "<!DOCTYPE html>\n\n<div class=\"model\" style=\"display: none;\">\n <video width=\"100%\" controls autoplay></video>\n <audio wi"
},
{
"path": "examples/basic/user.html",
"chars": 70,
"preview": "<!DOCTYPE html>\n<p>Moved to <a href=\"./post.html\">./post.html</a>!</p>"
},
{
"path": "examples/basic/video.html",
"chars": 1907,
"preview": "<!DOCTYPE html>\n\n<video id=\"video\" width=\"100%\" controls autoplay></video>\n<center>\n <input id=\"pass\" placeholder=\"pass"
},
{
"path": "examples/chat/index.html",
"chars": 5213,
"preview": "<!DOCTYPE html>\n<html>\n\n<head>\n <title>Converse</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-sc"
},
{
"path": "examples/chat/user.html",
"chars": 905,
"preview": "<script src=\"/gun.js\"></script>\n<!--\n<script src=\"/gun/lib/cryptomodules.js\" type=\"text/javascript\"></script>\n<script sr"
},
{
"path": "examples/contact/index.html",
"chars": 10174,
"preview": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<link rel=\"style"
},
{
"path": "examples/docs.html",
"chars": 10501,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n<!-- always start with these two lines to set a clean baseline for different devices -->\n<"
},
{
"path": "examples/express.js",
"chars": 663,
"preview": "console.log(\"If module not found, install express globally `npm i express -g`!\");\r\nvar port = process.env.OPENSHIFT_N"
},
{
"path": "examples/game/furball.html",
"chars": 12896,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n<!-- always start with these two lines to set a clean baseline for different devices -->\n<"
},
{
"path": "examples/game/nts.html",
"chars": 608,
"preview": "<html>\n\t<head>\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t</head>\n\t<body style=\"text-alig"
},
{
"path": "examples/game/space.html",
"chars": 7223,
"preview": "<html>\n\t<head>\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n\t</head>\n\t<div id=\"area\">\n\t\t<div"
},
{
"path": "examples/game/win.html",
"chars": 9077,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n<!-- always start with these two lines to set a clean baseline for different devices -->\n<"
},
{
"path": "examples/hapi.js",
"chars": 972,
"preview": "console.log(\"If module not found, install hapi globally `npm i hapi inert -g`!\")\n\nconst Hapi = require('hapi')\nconst In"
},
{
"path": "examples/http.js",
"chars": 1181,
"preview": ";(function(){\n\tvar cluster = require('cluster');\n\tif(cluster.isMaster){\n\t return cluster.fork() && cluster.on('exit',fu"
},
{
"path": "examples/https.sh",
"chars": 306,
"preview": "#!/bin/bash\ncd ~\ngit clone https://github.com/acmesh-official/acme.sh.git\ncd ~/acme.sh\n./acme.sh --install -m $EMAIL\n\nba"
},
{
"path": "examples/index.html",
"chars": 173,
"preview": "<!DOCTYPE html>\r\n<p>This is the examples folder.\r\n<p>The most basic example is <a href=\"./basic/note.html\">./basic/note."
},
{
"path": "examples/infinite-scroll/ScrollWindow.js",
"chars": 2989,
"preview": "const DEFAULT_OPTIONS = {\n size: 20,\n stickTo: 'top',\n};\n\nclass ScrollWindow {\n constructor(gunNode, opts = {}) {\n "
},
{
"path": "examples/infinite-scroll/index.html",
"chars": 860,
"preview": "<html>\n <head>\n <title>Infinite scroll example</title>\n <meta name=\"viewport\" content=\"width=device-width, initia"
},
{
"path": "examples/infinite-scroll/index.js",
"chars": 5478,
"preview": "const gun = new Gun();\n\nconst size = 20;\nconst gunNode = gun.get('posts');\n\nfunction debounce(func, wait, immediate) {\n "
},
{
"path": "examples/infinite-scroll/style.css",
"chars": 888,
"preview": "html, body {\n margin: 0;\n padding: 0;\n}\n\nbody {\n padding-top: 65px;\n}\n\nheader {\n background: rgba(255,255,255,0.75);"
},
{
"path": "examples/install.sh",
"chars": 1778,
"preview": "#!/bin/bash\n\n# README\n# This will install nodejs and npm on your system,\n# should work on most places other than Windows"
},
{
"path": "examples/jquery.js",
"chars": 97162,
"preview": "/*! jQuery v1.12.4 | (c) jQuery Foundation | jquery.org/license */\n!function(a,b){\"object\"==typeof module&&\"object\"==typ"
},
{
"path": "examples/json/index.html",
"chars": 2507,
"preview": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\t\t<script src=\"../"
},
{
"path": "examples/move/index.html",
"chars": 7643,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <!--\n HELP WANTED!\n Build decentralized Open Source Uber/Lyft!\n Need "
},
{
"path": "examples/party.html",
"chars": 26147,
"preview": "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<title>Party by Neon ERA</title>\n\t\t<meta name=\"viewport\" content=\"width=device-width, i"
},
{
"path": "examples/react/README.md",
"chars": 415,
"preview": "You can use `todo.html` as a project template to get started with React + GUN.\n\nIt is an extremely simple in-memory only"
},
{
"path": "examples/react/public/index.html",
"chars": 1231,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <link href=\"https://fonts.googleapis.com/css?fa"
},
{
"path": "examples/react/src/App.js",
"chars": 601,
"preview": "import React, { Component } from 'react'\nimport Gun from 'gun/gun'\nimport Todos from './Todos'\nimport Chat from './Chat'"
},
{
"path": "examples/react/src/App.test.js",
"chars": 208,
"preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\n\nit('renders without crashing', ()"
},
{
"path": "examples/react/src/Chat.js",
"chars": 1725,
"preview": "import React, { Component } from 'react'\nimport Gun from 'gun/gun'\n\nconst formatMsgs = msgs => Object.keys(msgs)\n .map"
},
{
"path": "examples/react/src/Json.js",
"chars": 1073,
"preview": "import React, { Component } from 'react'\n\nconst formatJson = json =>\n Object.keys(json)\n .map(key => ({ key, val: j"
},
{
"path": "examples/react/src/Todos.js",
"chars": 1142,
"preview": "import React, { Component } from 'react'\nimport Gun from 'gun/gun'\nimport path from 'gun/lib/path'\nimport './style.css'"
},
{
"path": "examples/react/src/index.css",
"chars": 63,
"preview": "body {\n margin: 0;\n padding: 0;\n font-family: sans-serif;\n}\n"
},
{
"path": "examples/react/src/index.js",
"chars": 174,
"preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './App';\nimport './index.css';\n\nReactDOM.re"
},
{
"path": "examples/react/src/style.css",
"chars": 271,
"preview": "html, body { font-size: 14pt; padding: 10px 2.5%;}\n.hide { display: none; }\nform .who { width: 10%; }\nform .what { width"
},
{
"path": "examples/react/todo.html",
"chars": 1314,
"preview": "<!DOCTYPE html>\n<html>\n <body>\n <div id=\"app\"></div>\n <script src=\"https://unpkg.com/react@16/umd/react.developme"
},
{
"path": "examples/react-native/.babelrc",
"chars": 60,
"preview": "{\n \"presets\": [\"module:metro-react-native-babel-preset\"]\n}\n"
},
{
"path": "examples/react-native/.buckconfig",
"chars": 114,
"preview": "\n[android]\n target = Google Inc.:Google APIs:23\n\n[maven_repositories]\n central = https://repo1.maven.org/maven2\n"
},
{
"path": "examples/react-native/.flowconfig",
"chars": 2307,
"preview": "[ignore]\n; We fork some components by platform\n.*/*[.]android.js\n\n; Ignore \"BUCK\" generated dirs\n<PROJECT_ROOT>/\\.buckd/"
},
{
"path": "examples/react-native/.gitattributes",
"chars": 16,
"preview": "*.pbxproj -text\n"
},
{
"path": "examples/react-native/.gitignore",
"chars": 793,
"preview": "# OSX\n#\n.DS_Store\n\n# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.p"
},
{
"path": "examples/react-native/.watchmanconfig",
"chars": 2,
"preview": "{}"
},
{
"path": "examples/react-native/README.md",
"chars": 1228,
"preview": "# Gun on react-native!\n---\n### running the demo\n1. do `yarn install` on the directory of the demo `examples/react-native"
},
{
"path": "examples/react-native/android/app/BUCK",
"chars": 1572,
"preview": "# To learn about Buck see [Docs](https://buckbuild.com/).\n# To run your application with Buck:\n# - install Buck\n# - `npm"
},
{
"path": "examples/react-native/android/app/build.gradle",
"chars": 6063,
"preview": "apply plugin: \"com.android.application\"\n\nimport com.android.build.OutputFile\n\n/**\n * The react.gradle file registers a t"
},
{
"path": "examples/react-native/android/app/proguard-rules.pro",
"chars": 667,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /u"
},
{
"path": "examples/react-native/android/app/src/main/AndroidManifest.xml",
"chars": 996,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.gundemo\">\n\n <uses-permission an"
},
{
"path": "examples/react-native/android/app/src/main/assets/html/blank.html",
"chars": 0,
"preview": ""
},
{
"path": "examples/react-native/android/app/src/main/java/com/gundemo/MainActivity.java",
"chars": 359,
"preview": "package com.gundemo;\n\nimport com.facebook.react.ReactActivity;\n\npublic class MainActivity extends ReactActivity {\n\n /"
},
{
"path": "examples/react-native/android/app/src/main/java/com/gundemo/MainApplication.java",
"chars": 1154,
"preview": "package com.gundemo;\n\nimport android.app.Application;\n\nimport com.facebook.react.ReactApplication;\nimport com.github.ali"
},
{
"path": "examples/react-native/android/app/src/main/res/values/strings.xml",
"chars": 70,
"preview": "<resources>\n <string name=\"app_name\">GunDemo</string>\n</resources>\n"
},
{
"path": "examples/react-native/android/app/src/main/res/values/styles.xml",
"chars": 192,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">"
},
{
"path": "examples/react-native/android/build.gradle",
"chars": 974,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n e"
},
{
"path": "examples/react-native/android/gradle/wrapper/gradle-wrapper.properties",
"chars": 200,
"preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dist"
},
{
"path": "examples/react-native/android/gradle.properties",
"chars": 856,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "examples/react-native/android/gradlew",
"chars": 5296,
"preview": "#!/usr/bin/env sh\n\n##############################################################################\n##\n## Gradle start up"
},
{
"path": "examples/react-native/android/gradlew.bat",
"chars": 2260,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
},
{
"path": "examples/react-native/android/keystores/BUCK",
"chars": 152,
"preview": "keystore(\n name = \"debug\",\n properties = \"debug.keystore.properties\",\n store = \"debug.keystore\",\n visibility"
},
{
"path": "examples/react-native/android/keystores/debug.keystore.properties",
"chars": 105,
"preview": "key.store=debug.keystore\nkey.alias=androiddebugkey\nkey.store.password=android\nkey.alias.password=android\n"
},
{
"path": "examples/react-native/android/settings.gradle",
"chars": 225,
"preview": "rootProject.name = 'GunDemo'\ninclude ':react-native-webview-bridge'\nproject(':react-native-webview-bridge').projectDir ="
},
{
"path": "examples/react-native/app.json",
"chars": 51,
"preview": "{\n \"name\": \"GunDemo\",\n \"displayName\": \"GunDemo\"\n}"
},
{
"path": "examples/react-native/index.js",
"chars": 232,
"preview": "/** @format */\nimport './shim';\nimport {AppRegistry} from 'react-native';\nimport App from './src/App';\nimport {name as a"
},
{
"path": "examples/react-native/ios/GunDemo/AppDelegate.h",
"chars": 325,
"preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n"
},
{
"path": "examples/react-native/ios/GunDemo/AppDelegate.m",
"chars": 1256,
"preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n"
},
{
"path": "examples/react-native/ios/GunDemo/Base.lproj/LaunchScreen.xib",
"chars": 3710,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" versi"
},
{
"path": "examples/react-native/ios/GunDemo/Images.xcassets/AppIcon.appiconset/Contents.json",
"chars": 585,
"preview": "{\n \"images\" : [\n {\n \"idiom\" : \"iphone\",\n \"size\" : \"29x29\",\n \"scale\" : \"2x\"\n },\n {\n \"idiom\""
},
{
"path": "examples/react-native/ios/GunDemo/Images.xcassets/Contents.json",
"chars": 63,
"preview": "{\n \"info\" : {\n \"version\" : 1,\n \"author\" : \"xcode\"\n }\n}\n"
},
{
"path": "examples/react-native/ios/GunDemo/Info.plist",
"chars": 1754,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "examples/react-native/ios/GunDemo/main.m",
"chars": 384,
"preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n"
},
{
"path": "examples/react-native/ios/GunDemo-tvOS/Info.plist",
"chars": 1611,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "examples/react-native/ios/GunDemo-tvOSTests/Info.plist",
"chars": 765,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "examples/react-native/ios/GunDemo.xcodeproj/project.pbxproj",
"chars": 63834,
"preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
},
{
"path": "examples/react-native/ios/GunDemoTests/GunDemoTests.m",
"chars": 1935,
"preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n"
},
{
"path": "examples/react-native/ios/GunDemoTests/Info.plist",
"chars": 733,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
},
{
"path": "examples/react-native/package.json",
"chars": 710,
"preview": "{\n \"name\": \"GunDemo\",\n \"version\": \"0.0.1\",\n \"private\": true,\n \"scripts\": {\n \"start\": \"node node_modules/react-nat"
},
{
"path": "examples/react-native/shim.js",
"chars": 592,
"preview": "if (typeof __dirname === 'undefined') global.__dirname = '/'\nif (typeof __filename === 'undefined') global.__filename = "
},
{
"path": "examples/react-native/src/App/Demo.js",
"chars": 4326,
"preview": "import * as React from 'react';\nimport {View, StyleSheet, TextInput, Text, TouchableOpacity, AsyncStorage} from 'react-n"
},
{
"path": "examples/react-native/src/App/PolyFillCrypto.js",
"chars": 2463,
"preview": "import * as React from 'react';\nimport { Platform, StyleSheet, View } from 'react-native';\n\nimport WebViewBridge from 'r"
},
{
"path": "examples/react-native/src/App/app.js",
"chars": 404,
"preview": "/**\n * Sample React Native App\n * https://github.com/facebook/react-native\n *\n * @format\n * @flow\n */\n\nimport React, {Co"
},
{
"path": "examples/react-native/src/App/index.js",
"chars": 38,
"preview": "export {App as default} from './app';\n"
},
{
"path": "examples/react-native/src/extensions/asyncStorageAdapter.js",
"chars": 1341,
"preview": "import * as Gun from 'gun';\nimport { AsyncStorage } from 'react-native';\n\nconst readNode = (key, cb) => {\n\tAsyncStorage."
},
{
"path": "examples/react-native/src/extensions/sea.js",
"chars": 47341,
"preview": ";(function(){\n\n /* UNBUILD */\n var root;\n if(typeof window !== \"undefined\"){ root = window }\n if(typeof global !== \""
},
{
"path": "examples/react-native/src/webview-crypto/MainWorker.d.ts",
"chars": 406,
"preview": "export default class MainWorker {\n private sendToWebView;\n private debug;\n readonly crypto: Crypto;\n private"
},
{
"path": "examples/react-native/src/webview-crypto/MainWorker.js",
"chars": 5176,
"preview": "import serializeError from 'serialize-error';\nimport { parse, stringify } from './serializeBinary';\nconst SUBTLE_METHODS"
},
{
"path": "examples/react-native/src/webview-crypto/WebViewWorker.d.ts",
"chars": 206,
"preview": "export declare class WebViewWorker {\n private sendToMain;\n constructor(sendToMain: (message: string) => void);\n "
},
{
"path": "examples/react-native/src/webview-crypto/WebViewWorker.js",
"chars": 2849,
"preview": "var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Pro"
},
{
"path": "examples/react-native/src/webview-crypto/asyncSerialize.d.ts",
"chars": 366,
"preview": "export interface ISerializer<T, S> {\n id: string;\n isType: (o: any) => boolean;\n toObject?: (t: T) => Promise<S"
},
{
"path": "examples/react-native/src/webview-crypto/asyncSerialize.js",
"chars": 2170,
"preview": "var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Pro"
},
{
"path": "examples/react-native/src/webview-crypto/compat.d.ts",
"chars": 48,
"preview": "export declare function subtle(): SubtleCrypto;\n"
},
{
"path": "examples/react-native/src/webview-crypto/compat.js",
"chars": 126,
"preview": "export function subtle() {\n return window.crypto.subtle || window.crypto.webkitSubtle;\n}\n//# sourceMappingURL=compat."
},
{
"path": "examples/react-native/src/webview-crypto/index.d.ts",
"chars": 140,
"preview": "import MainWorker from './MainWorker';\nimport webViewWorkerString from './webViewWorkerString';\nexport { MainWorker, web"
},
{
"path": "examples/react-native/src/webview-crypto/index.js",
"chars": 173,
"preview": "import MainWorker from './MainWorker';\nimport webViewWorkerString from './webViewWorkerString';\nexport { MainWorker, web"
},
{
"path": "examples/react-native/src/webview-crypto/serializeBinary.d.ts",
"chars": 271,
"preview": "export declare function parse(text: string): Promise<any>;\nexport declare function stringify(value: any, waitForArrayBuf"
},
{
"path": "examples/react-native/src/webview-crypto/serializeBinary.js",
"chars": 5970,
"preview": "var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n return new (P || (P = Pro"
},
{
"path": "examples/react-native/src/webview-crypto/webViewWorkerString.d.ts",
"chars": 69566,
"preview": "export declare const base64InjString = \"\\n(function (global, factory) {\\n typeof exports === 'object' && typeof modul"
},
{
"path": "examples/react-native/src/webview-crypto/webViewWorkerString.js",
"chars": 67021,
"preview": "export const base64InjString = `\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'und"
},
{
"path": "examples/relay-sqlite-example/README.md",
"chars": 379,
"preview": "# gun-relay-sqlite\n\nManager+Adapter Stable version\n\nSupport iOS & Android \n\n# Quickly build a relay manager and Gun stor"
},
{
"path": "examples/relay-sqlite-example/capacitor.config.ts",
"chars": 1139,
"preview": "import { CapacitorConfig } from '@capacitor/cli';\nimport { CapacitorHttp } from '@capacitor/core';\nimport { KeyboardResi"
},
{
"path": "examples/relay-sqlite-example/index.html",
"chars": 917,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Gun-Relay-sqlite</title>\n\n <base hr"
},
{
"path": "examples/relay-sqlite-example/package.json",
"chars": 7104,
"preview": "{\n \"name\": \"gun-relay-sqlite\",\n \"private\": true,\n \"version\": \"0.0.1\",\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \""
},
{
"path": "examples/relay-sqlite-example/src/App.vue",
"chars": 2096,
"preview": "<template>\n <ion-app>\n\n\n\n\n <ion-router-outlet />\n\n\n \n </ion-app>\n</template>\n\n<script setup lang=\"ts\">\nimport { on"
},
{
"path": "examples/relay-sqlite-example/src/components/RelayMode.vue",
"chars": 13205,
"preview": "<script setup lang=\"ts\">\nimport { ref, computed, onMounted, watch } from 'vue';\nimport { useNetworkStatus } from '@/comp"
},
{
"path": "examples/relay-sqlite-example/src/composables/GunStorageAdapter.ts",
"chars": 6906,
"preview": "import { ref, Ref } from 'vue';\nimport { Flint, NodeAdapter } from 'gun-flint';\nimport StorageService from '../services/"
},
{
"path": "examples/relay-sqlite-example/src/composables/useNetwork.ts",
"chars": 3037,
"preview": "\nimport { ref } from 'vue';\nimport Gun, { IGunInstance } from 'gun';\n\n// 模块级别的单例状态\nconst isOnline = ref(navigator.onLine"
},
{
"path": "examples/relay-sqlite-example/src/composables/useNetworkStatus.ts",
"chars": 17100,
"preview": "import { ref, watch } from 'vue';\nimport { useToast } from '@/composables/useToast';\nimport { useNetwork } from '@/compo"
},
{
"path": "examples/relay-sqlite-example/src/composables/useToast.ts",
"chars": 2166,
"preview": "// src/composables/useToast.ts\nimport { ref, onMounted } from 'vue';\nimport { Directory, Encoding, Filesystem } from '@c"
},
{
"path": "examples/relay-sqlite-example/src/main.ts",
"chars": 2754,
"preview": "import { createApp } from 'vue'\nimport App from './src/App.vue'\nimport router from './router';\n\nimport { IonicVue } from"
},
{
"path": "examples/relay-sqlite-example/src/pages/index.vue",
"chars": 5919,
"preview": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\n\nimport {\n IonPage, IonHeader, IonToolbar, IonButtons, IonBackButto"
},
{
"path": "examples/relay-sqlite-example/src/router/index.ts",
"chars": 993,
"preview": "import { createRouter, createWebHistory } from '@ionic/vue-router'\nimport { createAnimation } from '@ionic/vue'\nimport r"
},
{
"path": "examples/relay-sqlite-example/src/services/dbVersionService.ts",
"chars": 656,
"preview": "export interface IDbVersionService {\n setDbVersion(dbName: string, version: number): void\n getDbVersion(dbName: st"
},
{
"path": "examples/relay-sqlite-example/src/services/globalServices.ts",
"chars": 336,
"preview": "import SQLiteService from './sqliteService';\nimport DbVersionService from './dbVersionService';\nimport StorageService fr"
},
{
"path": "examples/relay-sqlite-example/src/services/initializeAppService.ts",
"chars": 1622,
"preview": "import {ISQLiteService } from '../services/sqliteService'; \nimport {IStorageService } from '../services/storageService';"
},
{
"path": "examples/relay-sqlite-example/src/services/sqliteService.ts",
"chars": 4568,
"preview": "import { CapacitorSQLite, SQLiteConnection, SQLiteDBConnection, capSQLiteUpgradeOptions } from '@capacitor-community/sql"
},
{
"path": "examples/relay-sqlite-example/src/services/storageService.ts",
"chars": 4208,
"preview": "import { BehaviorSubject } from 'rxjs';\nimport { CapacitorSQLite, SQLiteDBConnection } from '@capacitor-community/sqlite"
},
{
"path": "examples/relay-sqlite-example/src/theme/variables.css",
"chars": 7105,
"preview": "/* Ionic Variables and Theming. For more info, please see:\nhttp://ionicframework.com/docs/theming/ */\n\n/** Ionic CSS Var"
},
{
"path": "examples/relay-sqlite-example/tsconfig.json",
"chars": 590,
"preview": "{\n \"compilerOptions\": {\n \"target\": \"ESNext\",\n \"useDefineForClassFields\": true,\n \"module\": \"ESNext\",\n \"modul"
},
{
"path": "examples/relay-sqlite-example/tsconfig.node.json",
"chars": 184,
"preview": "{\n \"compilerOptions\": {\n \"composite\": true,\n \"module\": \"ESNext\",\n \"moduleResolution\": \"Node\",\n \"allowSynthe"
},
{
"path": "examples/relay-sqlite-example/vite.config.ts",
"chars": 1521,
"preview": "import legacy from '@vitejs/plugin-legacy'\nimport vue from '@vitejs/plugin-vue'\nimport path from 'path'\nimport { defineC"
},
{
"path": "examples/relay.service",
"chars": 383,
"preview": "[Unit]\nDescription=GUN relay\nDocumentation=https://gun.eco\nAfter=network.target\n\n[Install]\nWantedBy=multi-user.target\n\n["
},
{
"path": "examples/smoothie.js",
"chars": 44603,
"preview": "// MIT License:\n//\n// Copyright (c) 2010-2013, Joe Walnes\n// 2013-2018, Drew Noakes\n//\n// Permission is he"
},
{
"path": "examples/start.js.html",
"chars": 705,
"preview": "/*<!DOCTYPE html>\n<html>\n<head></head>\n<body></body>\n<script>// */\n;(function(){try{\n\tif(typeof window == \"undefined\"){ "
},
{
"path": "examples/stats.html",
"chars": 6564,
"preview": "<!DOCTYPE HTML>\n<html>\n<head>\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<link rel=\"stylesheet"
},
{
"path": "examples/style.css",
"chars": 7114,
"preview": "html, body {\n\tmargin: 0;\n\tpadding: 0;\n\tposition: relative;\n line-height: 1.5;\n font-size: 18pt;\n f-ont-size: max(18pt"
},
{
"path": "examples/todo/index.html",
"chars": 4044,
"preview": "<!DOCTYPE html>\r\n<html>\r\n\r\n<head>\r\n <title>Think</title>\r\n <meta name=\"viewport\" content=\"width=device-width, initial-"
},
{
"path": "examples/vanilla/screen.html",
"chars": 2135,
"preview": "<!DOCTYPE html>\n<html>\n\n<head>\n <title>Think</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale"
},
{
"path": "examples/vanilla/todo.html",
"chars": 1600,
"preview": "<!DOCTYPE html>\n<html>\n\n<head>\n <title>Think</title>\n <meta name=\"viewport\" content=\"width=device-width, initial-scale"
},
{
"path": "examples/vanilla/user.html",
"chars": 1670,
"preview": "<!DOCTYPE html>\n\n<h1>User</h1>\n\n<form id=\"sign\">\n <input id=\"alias\" placeholder=\"username\">\n <input id=\"pass\" type=\"pa"
},
{
"path": "examples/vanilla/video.html",
"chars": 2450,
"preview": "<!DOCTYPE html>\n\n<video id=\"video\" width=\"100%\" controls autoplay></video>\n<center>\n <input id=\"pass\" placeholder=\"pass"
},
{
"path": "examples/vue/index.html",
"chars": 6461,
"preview": "<html>\n<head>\n <title>Gun plugin for Vue</title>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device"
},
{
"path": "examples/vue/todo.html",
"chars": 4102,
"preview": "<!doctype html>\n<html>\n\n<head>\n <title>Todo App: Gun + Vue</title>\n \n <script src=\"https://unpkg.com/vue\" type="
},
{
"path": "examples/wave.html",
"chars": 1134,
"preview": "<!DOCTYPE HTML>\n<html>\n <head>\n <title>Wave example</title>\n </head>\n <body>\n <button id=\"bPiano\">Piano left</b"
},
{
"path": "examples/webpack/.gitignore",
"chars": 37,
"preview": "package-lock.json\nnode_modules\npublic"
},
{
"path": "examples/webpack/package.json",
"chars": 394,
"preview": "{\n \"name\": \"webpack\",\n \"version\": \"1.0.0\",\n \"description\": \"webpack build example\",\n \"scripts\": {\n \"build\": \"webp"
},
{
"path": "examples/webpack/src/app.js",
"chars": 199,
"preview": "define(function(require, exports, module) {\n\n var Gun = require(\"gun\");\n\n var gun = new Gun();\n\n gun.get(\"hello"
},
{
"path": "examples/webpack/src/index.html",
"chars": 66,
"preview": "<!DOCTYPE html>\n<html>\n <head></head>\n <body></body>\n</html>"
}
]
// ... and 371 more files (download for full content)
About this extraction
This page contains the full source code of the amark/gun GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 571 files (3.6 MB), approximately 967.3k tokens, and a symbol index with 1240 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.