Code Monkey home page Code Monkey logo

gun-tag's People

Contributors

amark avatar jsdelivrbot avatar stefdv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

gun-tag's Issues

Running .tagged() on a node

I can't tell from the docs, if that's the intended behavior, but I think the gun.tagged() is not behaving as expected when run on a node (not on root). For example, I am trying to do:

this.$gun.get('someitem').put({ title: 'SOME ITEM' })
this.$gun.get('someitem').tag([’tag1, ’tag2’])

//later then…
this.$gun
      .get('someitem')
      .tagged(r => {
        console.log(r)
      })

It doesn’t even run. I see the tags property is there on the node, e.g. gun.get('someitem').get('tags') but I just can’t get the list with .tagged() I’ve tried with tagged().once( … ) as well.

I would assume the ideal would be to get a callback which:

  • if no params are passed gun.get('someitem').tagged() would return all tags on that node
  • if a param is passed, filter out and list only the child tags (as described in the docs)

I am relying on my own getter at the moment, but I am not sure how I can filter out those that have been untagged - as you note in the docs, the tags will show in the tags property even after untagged, but it may not necessarily mean that it's active.

Possible bug with tag([]).

Please see inline comments.

<html>
	<body>
		<script src="gun_v0.8.3.js"></script>
		<script src="gun-tag_v2.0.3.js"></script>
		<script>
			localStorage.clear();
			var gun = Gun();
			var a = gun.get('alice').put({name:'Alice'});
			var b = gun.get('bob').put({name:'Bob'});
			var c = gun.get('carl').put({name:'Carl'});
			b.tag('friends/alice');
			c.tag(['friends/bob','friends/alice']);	//c.tag(['friends/alice','friends/bob']) works fine
			console.log('Expected:');
			console.log('Bob');
			console.log('Carl');
			console.log('Actual:');
			gun.tagged('friends/alice', function(v) {console.log(v.name)});	//Actual: Bob
		</script>
	</body>
</html>

How to get all tags for one node

To me it seems a bit unclear how to best read all the tags attached to a node. To me it seems the Readme contains only examples on how to get the nodes which have a common tag but not the other way round. Am I missing something?

Currently, I'm getting the tags like this

gun.get('something').get('tags').load(tags => {
    for (const tag in tags) {
      console.log(tag);
    }
  });

But this seems not to hold for untagged tags. How do I get all the (not untagged) tags which are attached to 'something'?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.