Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 15:14
    greenkeeper[bot] commented #5375
  • 15:14

    greenkeeper[bot] on core-js-3.3.1

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

  • 14:49
    greenkeeper[bot] labeled #5375
  • 14:49
    greenkeeper[bot] opened #5375
  • 14:49

    greenkeeper[bot] on core-js-3.3.0

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

  • Oct 12 18:35
    matthewp commented #5358
  • Oct 12 18:15
    chasenlehara commented #5358
  • Oct 12 06:41

    greenkeeper[bot] on @octokit

    (compare)

  • Oct 12 06:39

    greenkeeper[bot] on @octokit

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

  • Oct 11 19:01
    m-mujica edited #5374
  • Oct 11 19:01
    m-mujica opened #5374
  • Oct 11 19:00

    m-mujica on update-deep-observable

    Update can-deep-observable to l… (compare)

  • Oct 11 18:55
    m-mujica edited #5365
  • Oct 11 18:54
    greenkeeper[bot] labeled #5373
  • Oct 11 18:54
    greenkeeper[bot] opened #5373
  • Oct 11 18:54

    greenkeeper[bot] on can-deep-observable-1.0.1

    fix(package): update can-deep-o… (compare)

  • Oct 11 16:42
    LakshanKarunathilake starred canjs/canjs
  • Oct 11 14:58
    greenkeeper[bot] labeled #5372
  • Oct 11 14:58
    greenkeeper[bot] opened #5372
  • Oct 11 14:58

    greenkeeper[bot] on can-observable-mixin-1.0.1

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

AntonProkofyev
@AntonProkofyev
ok i will try thx
Mohamed Cherif Bouchelaghem
@cherifGsoul
you are welcome, just try to use the connection with a map and without Auth the get method needs an argument (eg: Id)
AntonProkofyev
@AntonProkofyev
ok and if i need to get something without argument ?
anyway will try to use map behavior
Mohamed Cherif Bouchelaghem
@cherifGsoul
what is the use case? getis to fetch one resource instance from web service for example, if you have another use case maybe using ajax in the component viewModel is simpler and do the job
AntonProkofyev
@AntonProkofyev

mmm ok i just have a try to implement it with ajax but still got an error

const AppViewModel = DefineMap.extend({  
    user: {
        get: function (last, resolve) {
            $.ajax({
                url: '/authServlet',
                type: 'GET'
            }).then(function(response){
                return $.ajax({
                    type: 'GET',
                    url: '/person',
                    contentType: 'application/json',
                    beforeSend: function (xhr) {
                        xhr.setRequestHeader('token', response.access_token);
                        xhr.setRequestHeader('lang', response.lang);
                    }
                })
            }).then(resolve);
        }
    }
});

/person returns {firstname:'foo', lastname'bar'}
the template is the same

{{user.firstname}}
<childConmonent  {user}="user"></childComponent>

and in child i just have

{{user.firstname}}

now i got

WARN: can-stache/src/expression.js: Unable to find key or helper "test.firstname".

jQuery.Deferred exception: Cannot define property _instanceDefinitions, object is not extensible TypeError: Cannot define property _instanceDefinitions, object is not extensible
    at Function.defineProperty (<anonymous>)
    at Object.defineExpando (https://localhost:3000/main.bundle.js?41ede84ce6df13df4e78:19848:11)
    at DefineMap.setKeyValue (https://localhost:3000/main.bundle.js?41ede84ce6df13df4e78:11105:30)
    at Object.setKeyValue (https://localhost:3000/main.bundle.js?41ede84ce6df13df4e78:15032:23)
    at Observation.observation.(anonymous function) (https://localhost:3000/main.bundle.js?41ede84ce6df13df4e78:45397:18) ....

sorry for a lot of text (

Mohamed Cherif Bouchelaghem
@cherifGsoul
"test.firstname" or "user.firstname"?
AntonProkofyev
@AntonProkofyev
user.firstname
Mohamed Cherif Bouchelaghem
@cherifGsoul
the quick fix:
const AppViewModel = DefineMap.extend({
 seal: false
},{... })
Mohamed Cherif Bouchelaghem
@cherifGsoul
English is not my 1st language :)
AntonProkofyev
@AntonProkofyev
=)
yes it helps
thank you a lot
Mohamed Cherif Bouchelaghem
@cherifGsoul
no problem
AntonProkofyev
@AntonProkofyev
is the DefineMap sealed by default?
Mohamed Cherif Bouchelaghem
@cherifGsoul
yes
I think is sealed when you extend it, if you instantiate (new DefineMap({foo:bar}) it is not sealed
AntonProkofyev
@AntonProkofyev
thx you again, you helped me a lot
Mohamed Cherif Bouchelaghem
@cherifGsoul
any time :)
Frank Lemanschik
@frank-dspeed
@chasenlehara new idea try to get that landet can-audit something that checks if models return a value to find fails in can-define-maps and such sturcutres
something that scans for commun pitfalls
we can't check if it returns the right value but we can easy check if all defined props return a value
And some how address the zones issue that it sometimes returns a white page or a partial rendered from donejs there needs to be info about that good view able for beginners so they understand why it don't renders
Frank Lemanschik
@frank-dspeed
maybe a faq section ? i can collect some often asked questions
as canjs page now got search
a faq would be the idal addition
alexey1986
@alexey1986
Hello! I have a problem with helper's and mustache templates. Can V.2.2.9. I trying to put text inside data-attr, but i see only '!!'. Do you know is it possible to fix it in mustache?
Mohamed Cherif Bouchelaghem
@cherifGsoul
@alexey1986 I think it was fixed with CanJS V2.3.x
@alexey1986 you must use data attributes?
alexey1986
@alexey1986
Thank you. It depends on there is a condition inside data attr or outside whole element. I use helper inside data attr.
Gregg Roemhildt
@roemhildtg
just curious if anyone uses any layout libraries with canjs? something that can be pretty flexible allowing multiple panes/sidebars etc. I've checked out golden-layout but was wondering if anyone else had used anything. Any suggestions would be very helpful :smile:
AntonProkofyev
@AntonProkofyev

hi guys, i have a question about routing

const AppViewModel = DefineMap.extend({    
    userName: 'string',
    page: 'string',   
    userId: 'number',
    ...etc
});

const appVM = new AppViewModel({});

route.data = appVM;
route('{page}/{userId}');
route.ready();

and it works but it also add other appVM props to the hash whenewer they changed.
like #!page/userId&userName=name
is it possible to see only #!page/userId in hash?

Kevin Phillips
@phillipskevin
you need to set serialize: false on those other properties
Mohamed Cherif Bouchelaghem
@cherifGsoul
@AntonProkofyev for the properties that you dont want to be serialized on route use serialize: false
AntonProkofyev
@AntonProkofyev
thx guys
Viktor Busko
@Lighttree

Guys, what is the purpose of set / algebra in can.js 3:
https://canjs.com/doc/can-set.html

It seems like this is used widely in examples for models and people use it. But to be honest I don't understand the use-case. Is this something that I must use ?

Frank Lemanschik
@frank-dspeed
it maps values
Viktor Busko
@Lighttree
mmm...
Frank Lemanschik
@frank-dspeed
as the name says set algebra
tells what to set on the viewmodel
Viktor Busko
@Lighttree
import DefineMap from 'can-define/map/map';
import DefineList from 'can-define/list/list';
import set from 'can-set';
import superMap from 'can-connect/can/super-map/super-map';
import loader from '@loader';

const Example = DefineMap.extend({
    seal: false
}, {
    id: 'any'
});

const algebra = new set.Algebra(
    set.props.id('id')
);

Example.List = DefineList.extend({
    '#': Example
});

Example.connection = superMap({
    url: loader.serviceBaseURL + '/example',
    Map: Example,
    List: Example.List,
    name: 'example',
    algebra
});

export default Example;
Why in this example id in set ? :)
what if I skip it ?