Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:09

    greenkeeper[bot] on steal-tools-2.2.3

    (compare)

  • 12:55

    greenkeeper[bot] on steal-tools-2.2.3

    chore(package): update steal-to… (compare)

  • 01:44

    greenkeeper[bot] on @webcomponents

    (compare)

  • 01:42

    greenkeeper[bot] on @webcomponents

    chore(package): update @webcomp… (compare)

  • Nov 12 05:28
    greenkeeper[bot] commented #5392
  • Nov 12 05:28

    greenkeeper[bot] on core-js-3.4.1

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

  • Nov 11 18:03
    greenkeeper[bot] labeled #5422
  • Nov 11 18:03
    greenkeeper[bot] opened #5422
  • Nov 11 18:03

    greenkeeper[bot] on @feathersjs

    chore(package): update @feather… (compare)

  • Nov 11 18:02
    greenkeeper[bot] commented #5401
  • Nov 11 18:02

    greenkeeper[bot] on @feathersjs

    chore(package): update @feather… (compare)

  • Nov 10 23:39

    greenkeeper[bot] on @octokit

    (compare)

  • Nov 10 23:37

    greenkeeper[bot] on @octokit

    chore(package): update @octokit… (compare)

  • Nov 08 16:08
    greenkeeper[bot] labeled #5421
  • Nov 08 16:08
    greenkeeper[bot] opened #5421
  • Nov 08 16:08

    greenkeeper[bot] on can-stache-bindings-5.0.2

    fix(package): update can-stache… (compare)

  • Nov 07 17:31

    cherifGsoul on 6-2-5-version

    (compare)

  • Nov 07 17:31
    cherifGsoul closed #5420
  • Nov 07 17:30

    cherifGsoul on master

    Update dist for release (compare)

  • Nov 07 17:28
    cherifGsoul edited as member
Justin Meyer
@justinbmeyer
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?
is a component necessary
@rasjani awesome. But if I might ask, why are you using webpack instead of StealJS?