Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 20:13
    phillipskevin synchronize #5421
  • 20:13

    phillipskevin on can-stache-bindings-5.0.2

    updating can-stache-bindings to… (compare)

  • 18:52
    cherifGsoul review_requested #5430
  • 18:47
    cherifGsoul edited #5430
  • 18:46
    cherifGsoul synchronize #5430
  • 18:46

    cherifGsoul on update-infrastructure-page

    Remove can-util and other stuff (compare)

  • 18:09
    jonathanzuniga starred canjs/canjs
  • 17:32
    mateus007 starred canjs/canjs
  • 16:12
    gregmartin06 starred canjs/canjs
  • 11:45
    alex-zhang starred canjs/canjs
  • Nov 21 19:51
    greenkeeper[bot] commented #5392
  • Nov 21 19:51

    greenkeeper[bot] on core-js-3.4.2

    chore(package): update core-js … (compare)

  • Nov 20 19:48

    phillipskevin on master

    Update dist for release (compare)

  • Nov 20 19:48

    phillipskevin on v6.2.7

    Update dist for release 6.2.7 (compare)

  • Nov 20 19:30

    phillipskevin on six-two-seven

    (compare)

  • Nov 20 19:30
    phillipskevin closed #5431
  • Nov 20 19:19
    phillipskevin synchronize #5431
  • Nov 20 19:19

    phillipskevin on six-two-seven

    updating dependencies (compare)

  • Nov 20 18:53
    cherifGsoul review_requested #5432
Justin Meyer
@justinbmeyer
@patrickclancy something like:
define: {
  isNameValid: {
    get: function(){
      return !!this.attr("name")
    }
  }
}
and you could create "mixins" that help set this up
define: validators({}, validateExists("name"))
opolyo01
@opolyo01
@daffl So yeah, promiseStore[ key ].then will be rejected within my components scope, but no while I am in the model. So I wonder would could reject the promise? I know I don't do .reject anywhere
Justin Meyer
@justinbmeyer
@ilyavf yes
do this in the view model
Patrick Clancy
@patrickclancy
@justinbmeyer interesting… I like using the define plugin… everything else is there. I’d need to roll in the check all type functionality that model.errors() provides. But that wouldn’t be hard
Justin Meyer
@justinbmeyer
yeah, the check functionality
is the one thing that this is missing
but in my opinion, having observability
is more important
oh, you mean check all
nm, that can be observable too
I am talking about the "if I set this, will it create an error"
behavior of validations
so you don't actually have to commit a breaking set
to see if there's an error
Patrick Clancy
@patrickclancy
@justinbmeyer is this the direction you’re thinking validation will go? We’ve got models with 60+ fields and observable is important. Bummer I just spent all day doing it the old way
@justinbmeyer I haven’t used this workflow "if I set this, will it create an error”. becasue of can-value live binding. I’d like to integrate that but haven’t
Justin Meyer
@justinbmeyer
yes, validation will certainly be observable
and probably be a plugin into the define plugin itself
if validations are important I can help you create something that bridges the gap
are you using stealjs?
Patrick Clancy
@patrickclancy
yes with ES6 syntax
Justin Meyer
@justinbmeyer
If you are using StealJS, we could create a can-validate repo and add you as a contributor
Patrick Clancy
@patrickclancy
wow… sounds good
Justin Meyer
@justinbmeyer
either @daffl or I could put a day in or so to get the basics working
@patrickclancy added you to: https://github.com/canjs/can-validate
can you create an issue with what you'd like?
perhaps something very close to the old validation but observable
oh, @patrickclancy using npm to install deps hopefully?
@daffl anyway you can setup a "shell" project sometime tomorrow? It can look like can-connect
btw, @patrickclancy not sure if you've seen can-connect
but I am aiming to have the docs done this week
Patrick Clancy
@patrickclancy
@justinbmeyer YES!! the only way to go. (can 2.3-pre as well)
@justinbmeyer I’ve seen can-connect and I’d like to use it but… docs would help
Justin Meyer
@justinbmeyer
ok, great, that will make working on can-validate stupidly easy
Patrick Clancy
@patrickclancy
@justinbmeyer Is place my order the best way to see can-connect in action?
Justin Meyer
@justinbmeyer
currently yes, but my docs will have demos
Patrick Clancy
@patrickclancy
@justinbmeyer sweet… thank you
Justin Meyer
@justinbmeyer
import connect from "can-connect";
import "can-connect/data/url/";
import "can-connect/constructor/";
import "can-connect/constructor/store/";
import fixture from "can/util/fixture/";

// A connection that gets todos data
var todosConnection = connect(["constructor-store","constructor","data-url"],{
  url: "/todos"
});

// Trap ajax requests to return and modify the following `todo` object.
var todo = { 
    id: 5, 
    name: "do the dishes"
};
fixture({
    "GET /todos/{id}": function(){
        todo.date = (+new Date());
        return todo;
    },
    "PUT /todos/{id}": function(request){
        todo.name = request.data.name;
        return {name: request.data.name, date: +new Date()};
    }
});

var makeTodoNamer = function(id){
    var element = document.createElement('div');
    var todo;

    var update = function(){
        element.firstChild.value = todo.name;
        element.childNodes[2].innerHTML = todo.date % 1000;
    };

    element.innerHTML = "<input/><button>X</button><span/>";

    todosConnection.get({id: id}).then(function(retrievedTodo){
        todo = retrievedTodo;
        Object.observe(todo,update, ["update"] );
        todosConnection.addInstanceReference(todo);
        update();
    });

    element.childNodes[1].onclick = function(){
        Object.unobserve(todo, update, ["update"] );
        todosConnection.deleteInstanceReference(todo);
        element.parentNode.removeChild(element);
    };
    element.firstChild.onchange = function(){
        todo.name = this.value;
    };

    element.firstChild.onkeypress = function(ev){
        if(ev.keyCode === 13) {
            todo.name = this.value;
            todosConnection.save(todo);
        }
    };

    return element;
};


document.getElementById('maker').onclick = function(){
    var element = makeTodoNamer(5);
    document.body.appendChild(element);
};
this is a can-connect example, done w/o can.Map
it uses connection.addInstanceReference to keep things in a store, and Object.observe to bind on them
Jani Mikkonen
@rasjani
Hiya, some time ago i promised to do a small blogpost about how to use canjs with webpack ..
blogpost is not yet written - but i had some spare time and i wrote working example on that topic @ https://github.com/rasjani/canjs_webpack
canjs part is very pretty but the main purpose is to actually just show how to build canjs project with webpack so it should be sufficient .. actual blogpost coming next :)
Diana Whitten
@hurgleburgler
@/all When building a component with CanJS ... is there a way to entirely replace the custom TAG in your dom with the contents of its template?
Matthew Phillips
@matthewp
@rasjani awesome
Alexis Abril
@alexisabril
@hurgleburgler You could call replaceWith on the inserted event(I’m not sure how to get a handle to the template offhand), however this sounds like something you could use can.view.attr() for. If you have a use case, it would provide more insight
Justin Meyer
@justinbmeyer
@hurgleburgler could you use a partial?