Comments (5)
GUN figures out whether you need to use new
for you:
function Gun(opt){
var gun = this;
if(!Gun.is(gun)){
return new Gun(opt);
}
gun.opt(opt);
}
So that way you don't have to worry about it. I think you can call it explicitly and it'll still work just fine var gun = new Gun(...);
but I should probably write tests to guarantee that. This just protects against common forgetfulness and it doesn't have any side effects.
from gun.
Okay, cool. It's more that I want to make sure that using new
still works, since my linter is throwing a warning whenever it comes across not using it.
from gun.
I suggest also exposing a '.create()' method, as that's the conventional way to expose the constructor when you want to avoid new.
from gun.
Documented. @PsychoLlama may make an extension which adds a .create()
method.
from gun.
Gun.create()
has been added as a code snippet, found here
from gun.
Related Issues (20)
- How to deploy gun server by Docker? HOT 4
- [Question] Netx.js support? HOT 1
- Why is the source code so bad? HOT 2
- Can not access docs HOT 2
- load() issue HOT 2
- Gun integration with express not working HOT 3
- Once dosen't trigger most of the time, when messages are authenticated to an user. HOT 1
- Gun not working with next.js 14.0.4 HOT 9
- Gun reports all documents always not only changed ones
- Referencing nodes that hold only primitive values HOT 2
- [BUG] Error when importing 'gun/lib/time.js' in nodejs HOT 1
- Use trystero for webrtc (with bittorrent dht signalling) HOT 8
- [BUG] mapping values in gun.user does not work properly HOT 10
- Setup without build tools HOT 1
- Proposal: GUN URIs to universally reference data HOT 2
- Question: How to split and distribute work? HOT 1
- Question: webseed functionality? HOT 1
- Have AI gen some contributor docs, docstrings, comments HOT 13
- node-webcrypto-oss deprecated HOT 3
- [BUG] gun server / nodejs / ERROR: Radisk needs `store.put` interface with `(file, data, cb)`!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gun.