Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Feb 18 23:43
    1d0n7kn0w starred canjs/canjs
  • Feb 14 12:04
    CalvinWalzel starred canjs/canjs
  • Feb 13 05:42
    liyanlong starred canjs/canjs
  • Feb 11 22:25
    greenkeeper[bot] commented #5450
  • Feb 11 22:25

    greenkeeper[bot] on semver-7.1.3

    chore(package): update semver t… (compare)

  • Feb 11 19:20

    greenkeeper[bot] on steal-tools-2.2.6

    (compare)

  • Feb 11 19:06

    greenkeeper[bot] on steal-tools-2.2.6

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

  • Feb 11 11:17

    greenkeeper[bot] on webpack-4.41.6

    (compare)

  • Feb 11 11:06

    greenkeeper[bot] on webpack-4.41.6

    chore(package): update webpack … (compare)

  • Feb 10 23:01
    cherifGsoul commented #5468
  • Feb 10 23:00
    cherifGsoul reopened #5468
  • Feb 10 22:59
    cherifGsoul closed #5468
  • Feb 10 22:59
    cherifGsoul commented #5468
  • Feb 09 05:23
  • Feb 08 20:24
    piraz opened #5468
  • Feb 08 10:41
    randy-r starred canjs/canjs
  • Feb 07 23:40
  • Feb 07 23:40
    MedRedha starred canjs/canjs
  • Feb 03 22:16

    greenkeeper[bot] on @octokit

    (compare)

  • Feb 03 22:15

    greenkeeper[bot] on @octokit

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

Kevin Phillips
@phillipskevin
component doesn’t do anything special to let you use the viewModel
Kyle Gifford
@kylegifford
thanks
Nils Lundquist
@nlundquist

hey all, I've got an issue with 2.3 that I'm wondering if anyone is familiar with:

trying to pass a function from a parent component to a child with a binding like {on-my-event}="@eventHandler" but since the child component is using a can.Map with a define, eventHandler is set as the define value property for onMyEvent and any define value function prop is called as if it's a value defaulter function. see the code around: https://github.com/canjs/canjs/blob/2.3-legacy/map/define/define.js#L45

only solution i can come up with is to pass the child component a function that returns the function i actually want to use as the value of the prop, but that seems like a pretty sad hack for something so simple.
Nils Lundquist
@nlundquist
def not intuitive to require a parent component to pass a child component wrapped functions to prevent this from happening
Justin Meyer
@justinbmeyer
@nlundquist if you want a default property value that is a function, the only way is to create a function that returns a function
but I'm not sure I understand you right
what you linked to only deals with maps ... seems like there's something around view bindings
Nils Lundquist
@nlundquist

hey Justin. I don't need a default value. I'm fine with the default property requiring a function to return a function since that's all in the view model config of the child. What I'm trying to do is pass a function from a parent component to a child component, and use that function within the child component logic.

Right now, whenever I pass a component from the parent component to the child component, the child component calls that function during it's a initialization because it thinks that function is a 'defaulter()' value like mentioned in the docs here: https://v2.canjs.com/docs/can.Map.prototype.define.value.html

I don't think there is an issue with the view bindings since the function is successfully passed from the parent component to child. The function is set on the child VM, in my example case, as the value on the onMyEvent property of the VM.

I just don't want that passed value to be called during child component VM initialization. The map/define/define.js code I linked to is where this function is added to the set of Map.defaultGenerators
I want to avoid that happening since i'm not passing a function for use as a default value generator, I'm passing it for use inside the child component logic
Nils Lundquist
@nlundquist
@justinbmeyer if what i'm trying to accomplish is still unclear lets jump on a screenshare
Justin Meyer
@justinbmeyer
@nlundquist can you create a JSBin?
do you need to use the * type?
Nils Lundquist
@nlundquist
i figured out my issue - it was in my code, the function i was trying to pass from the parent was itself a value property of a define map, so that needed to be a function that returned a function. figured it out as i was making a JSBin :sweat:
Gira Minus
@gKreator
blob
where does sound come from?
Justin Meyer
@justinbmeyer
@gKreator doesn't seem like anywhere. We probably need a better example
Gira Minus
@gKreator
I'm having the worst problem with canjs... it does not report most errors and just crashes silently
Chasen Le Hara
@chasenlehara
@gKreator Can you reproduce the issue in a JS Bin?
Gira Minus
@gKreator
No, it works on jsbin. I think I'm using a wrong combination of packages or something. I have the same issue on 2 projects.
Mike 'mitch' Mitchel
@mikemitchel
Hello all. If I have a stache in CanJS 2.3 with an href, href="{{feedbackFormUrl}}, can I make it open in a new tab/window with a built in can-stache solution or would I need to make a custom helper to handle it?
Mike 'mitch' Mitchel
@mikemitchel
answered my own question - much simpler than I thought target=“_blank”
Gira Minus
@gKreator
Yup
Mike 'mitch' Mitchel
@mikemitchel
in the a tag
helps to refresh the cache :-) as well
Guido Smeets
@gsmeets
does anyone know if creating references in a tree structure from child to parent (i.e. creating circular references) can cause memleaks? Or is canjs ( or the browser gc) smart enough to clean that up?
Gira Minus
@gKreator
Im pretty sure every variable in js is a reference
Frank Lemanschik
@frank-dspeed
@gsmeets good question i like it the answer is more complex then you think :) it depends on your code if gc cleans up or not most efficent way is to never let gc happen!
so if you want to clean up a var let do it from hand.
Its one of my core principals to never let gc even run !
a realy good example for a never cleaned Var or Let in CanJS is when you create streams where you never listen too :)
Gira Minus
@gKreator
Anyone have experience with merging multiple api ajax calls into one?
Frank Lemanschik
@frank-dspeed
@gKreator in general yes but it depends a bit on your use case

Not possible in most cases

Each ajax call involves the browser sending information to a server at a particular URL.

If you reduced the browser code from two ajax calls to one ajax call, the server would receive less information, the browser would not receive some information it is getting now, and/or the server would perform fewer operations.

If you control the server code, you might be able to change the server code to be able to do both operations in one step. Only then could you change the browser code.

for example to combine database querys i am as couchbase user :) can do simply chain querys and fire one big query
that returns multible results so i can reduce my ajax requests always to 1
but if you talk about for example ajax requests to json endpoints you cant merge them you can only wait till both promises are done
Conclusion merging requests client side is not possible by the coder :)
but http2 is merging such requests on protocol network layer
i am so happy when http2 is full standart then all this bundling packaging caching brings nothing anymore and we have much better applications :)
DaveO
@DaveO-Home

Issues with upgrade from Canjs 3.4.0 to Canjs 3.4.1:

  1. can/control - I have node_modules/can installed ("can": "^3.4.0",).
    steal("can/control"..., function(Control...) {

     Control.extend(...  <=====failed with "not a function" error.

    }

    Added "can-control": "*", to package and changed steal to;
    steal("can-control"..., function(Control...) {

     Control.extend <==== worked

    }

    Question, does the proper configuration for canjs require the individual modules in package.json? I find it convenient to just configure "can".

  2. Steal-tools: application is using the Steal-CSS extension,
    steal.import("node_modules/font-awesome/css/font-awesome.min.css"); Note: the app will build properly.
    Building with steal-tools javascript;

    !/usr/bin/env node

    var stealTools = require("steal-tools");
    //
    var promise = stealTools.build({ .....

Stack trace repeated for each css file import....

Potentially unhandled rejection [58] Error: Error loading "components/font-awesome/css/font-awesome.min.css!steal-css@1.2.1#css" at file:/home/daveo/NetBeans/Resume/web/components/font-awesome/css/font-awesome.min.css
Unable to load CSS in an environment without a document.
at getDocument (file:/home/daveo/NetBeans/Resume/web/node_modules/steal-css/css.js:36:8)
at load.metadata.execute (file:/home/daveo/NetBeans/Resume/web/node_modules/steal-css/css.js:224:7)
at linkDynamicModule (/home/daveo/NetBeans/Resume/node_modules/steal-systemjs/dist/system.src.js:743:32)
at link (/home/daveo/NetBeans/Resume/node_modules/steal-systemjs/dist/system.src.js:602:11)
at Object.execute (/home/daveo/NetBeans/Resume/node_modules/steal-systemjs/dist/system.src.js:934:11)
at doDynamicExecute (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1969:25)
at link (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:2017:24)
at doLink (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1791:7)
at updateLinkSetOnLoad (/home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1839:18)
at /home/daveo/NetBeans/Resume/node_modules/steal-es6-module-loader/dist/es6-module-loader.src.js:1645:11

Gira Minus
@gKreator
#1 its best to use them individually
DaveO
@DaveO-Home
Ok, but all of the other "can/" modules are working properly.
Gira Minus
@gKreator
Yeah it should all work
Its just kinda preferred to only load what is needed
Did u try to delete ur node_modules folder and reinstall?
DaveO
@DaveO-Home
steal-tools selects only what is used for production, I think?
Actually that is what I eventually did to get things working again, the the Control.extend issue remain.
Gira Minus
@gKreator
So #2 is working?