News for hackers. Stuff that matters.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @02:51AM (#7997451)
I have often wondered if the nice things provided by Angular.js can be provided in a simpler interface and Sentinel.js is the result of my attempts to do so. I need someone to take a look and tell me how much I have succeeded.

This is a small timetracking app for freelancers, that only uses html and javascript that I created using Sentinel.js. It uses local storage to store the data.

http://imakesnowflakes.com/ceasium/Ceasium.html

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by jwblackwell on Monday July 07, 2014 @06:39AM (#7998106)
I don't really understand why there is a need to simplify something like AngularJS. Kudos for building something but I'd rather stick with the battle tested version thanks. If you're building a single page app then the initial payload isn't a big deal anyway, so I don't really care if it's a few KB less.

Your simple example is (IMO) more complicated than the AngularJS version, and Sentinel JS requires Jquery:

https://angularjs.org/

Please correct me if I'm wrong, just don't see the benefit of using this over AngularJS, you're ultimately going to want more functionality anyway.

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @08:00AM (#7998332)
> Kudos for building something but I'd rather stick with the battle tested version thanks...

Thanks. And what you say is only reasonable. I wouldn't imagine Sentinel.js to be any where near as stable as Angular.js. I rewrote the whole thing three times, to get the code in a manageable form. There are tests that cover most of the functionality. Since there are only a handful of directives, there are actually less 'moving parts' than something big like angular.js. But still, there are a lot of things that can go wrong for some combination of directives.

And can you please tell me which example you found more complicated than the angular version? Also can you think of any use case that something like this would fail to meet?

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by threeseed on Monday July 07, 2014 @05:21AM (#7997850)
This actually looks more complicated that VueJS. Which I would highly, highly recommend.

It's one of the fastest out of all the frameworks, solid documentation and very easy to use.

http://vuejs.org

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @05:30AM (#7997891)
> This actually looks more complicated that VueJS.

Which part?

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by Kiro on Monday July 07, 2014 @05:41AM (#7997918)
How do you handle routing in VueJS?
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by notduncansmith on Monday July 07, 2014 @07:39AM (#7998266)
I don't think you do, that's why it's called Vue (View). Think of it more like Ractive or React - it's just the presentation layer, with 0 opinions about your routing or state management layers (as it should be, IMO).
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by cyounkins on Monday July 07, 2014 @10:55AM (#7999166)
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by julius on Monday July 07, 2014 @06:56AM (#7998150)
If you are looking for a templating/data-binding solution that works like Angular.js, but without all the framework stuff. You can actually use Angular.js for it.

All you have to do is get yourself a "scope" from Angular.js, which is linked to a DOM-Node, and you are good to go.

You can use my code [1], which will do this for you.

[1] https://github.com/julius/AngularLite

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @07:39AM (#7998265)
Yes, that was what I had in mind when I made this. Will try AngularLite now. Thank you for sharing.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by SchizoDuckie on Monday July 07, 2014 @09:46AM (#7998752)
So you have no directives, no routing, just 2 way data binding.

Sorry sir, you may have heard about angular.js but you don't understand it at all.

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @11:23AM (#7999302)
>So you have no directives, no routing, just 2 way data binding..

Well, there are directives, but not custom ones...

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by BPm on Monday July 07, 2014 @04:06AM (#7997618)
It does look simpler but could it be because there are less functionalities and it is less extensible? won't be enough to be called an alternative. I voted up though because I still think it's cool. Hope to see it grow further.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @04:57AM (#7997800)
>It does look simpler but could it be because there are less functionalities and it is less extensible?

Yes, probably. But these are my thoughts

1) How Important are the missing parts. For eg, I think you can define custom directives in angular.js. You can't do that with Sentinel.js. But can this be still useful without that feature? What I have tried to do is to minimize the number of 'things' that one needs to learn, by providing more powerful constructs. For eg, angular have ng-even and ng-odd directives to distinguish between even and odd iterations for a repeat loop. But in Sentinel.jS, you can give "sn-computed-" prefix for an attribute, and that attribute value will be evaluated and bound to the given expression. So you can cover a lot of cases with this feature that angular.js cover with a lot of directives.

2) Can we add those missing parts without sacrificing its simplicity. For eg, Dependency Injection. May be we can add it without making it a lot more complex.

Pardon me calling it as an alternative to angular.js. I just couldn't find another way to convey what it does under 80 characters. I know all of these are kind of naive. I know I am a nobody, and there is no way I can be right about these things. But those are my thoughts. Please correct me where I am wrong....

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by marcoms on Monday July 07, 2014 @04:26AM (#7997683)
Why does no client-side framework beside Knockout use data-* attributes? Whyy??
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @05:12AM (#7997832)
I didn't use it because I thought it would make it more verbose and I couldn't see any distinct advantage in doing so.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by Kiro on Monday July 07, 2014 @05:43AM (#7997923)
Why do you want data-* attributes? If only for validation, why?
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by aikah on Monday July 07, 2014 @07:02AM (#7998164)
you can use data-* attributes in angular,ng-repeat and data-ng-repeat are the same.Trust me they've got your coverred on this.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by skrebbel on Monday July 07, 2014 @04:31AM (#7997703)
React does.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by chenglou on Monday July 07, 2014 @04:46AM (#7997763)
No, React does internally, for the purpose of its diffing algorithm (which is subject to changes). React's public facing API does not use data-* whatsoever.

As a matter of fact, storing user data in data-* attributes is unnecessary in React. Just like graphics programming, you're better off storing vertices data in the data structures themselves, not in the final onscreen output of the vertices.

Re:Show HN: Sentinel.JS - The simplest alternative to angula... by skrebbel on Monday July 07, 2014 @05:07AM (#7997820)
Indeed. I don't believe the GP implied that the data-* had to be user data to count. In fact, the way data-bind is used in Knockout isn't really user data either. You'd store that on the view model, not in a data-* attribute.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by mattsouth on Monday July 07, 2014 @06:55AM (#7998149)
batmanjs does. Admittedly its a fairly niche framework but we use it a lot.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by ergo14 on Monday July 07, 2014 @06:51AM (#7998142)
angular does
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by Kiro on Monday July 07, 2014 @05:42AM (#7997921)
No support for routing?
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by imakesnowflakes on Monday July 07, 2014 @05:50AM (#7997955)
No. But why do you need that bundled with something like this? You got two way data binding, so use a separate routing library to read routes off the url and change a variable in the bound scope, and let the DOM update accordingly.
Re:Show HN: Sentinel.JS - The simplest alternative to angula... by notduncansmith on Monday July 07, 2014 @07:43AM (#7998281)
If you're looking for a dead-simple routing library for the client, allow me to shamelessly plug the one I wrote: https://github.com/notduncansmith/trails. I'm using it in conjunction with Rivets.js and Viewmaster.js in a framework I'm working on.