« first day (3328 days earlier)      last day (1845 days later) » 

00:17
Hi?
@NoobDev Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Anyone here?
can someone please help me with this? - stackoverflow.com/questions/59041730/…
 
1 hour later…
01:19
morn!
01:53
hello there, I would like some help with one of the questions I have posted, please.
I am just trying to filter the data to the correct user, I thought sessions/cookie would take care of that, but it does not. Please.
 
5 hours later…
06:56
|| mdn document.getElementById
@geisterfurz007 Invalid command! Try help for a list of available commands..‍.‍.‍.‍.‍.‍
That's nice!
 
1 hour later…
08:26
Good morning.
@bithub Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
good morning bithub
 
2 hours later…
09:59
Any elasticsearch users here? If you have a pascal case string does elastic search tokenize it into its respective components and create the inverted index?
10:31
yeet
 
1 hour later…
11:59
hey
I'm reading a couple article on best practices for API calls using NgRx
in an Angular app. Am I right in thinking just dispatch all requests via an action in the component. Then have an effect fire off the API request and appropriate response / error actions on the reducer?
or is there more to it than meets the eye? Like actions for request, request_success, request_failed
How to merge array and also unique array in jquery any one have idea about this

sample1 = ['Coffee', 'Ice Cream', 'Lemon'];
sample2 = ['tea', 'coco', 'Ice Cream'];

I want to final array like this $final = ['Coffee', 'tea', 'coco'];
What does jQuery have to do with this?
sample1 = ['Coffee', 'Ice Cream', 'Lemon'];
sample2 = ['tea', 'Ice Cream', 'coco'];

I want to final array like this $final = ['Coffee', 'Ice Cream', 'Lemon','tea'.'coco'];
@geisterfurz007Stopthischaos I want to merge array using jquery
that ahs been asked many times
it is just .filter + includes or use a Set (better option)
@KarelG But I also want unique array
12:11
that's what Set is, it is an object that represents a collection of unique elements
jQuery is a UI library for JavaScript. It has nothing to do with arrays.
set is just return a boolean value but i want to return array
the second option is
||> let a1 = ['Coffee', 'Ice Cream', 'Lemon']; let a2 = ['tea', 'Ice Cream', 'coco']; let s = new Set(a1); a2.forEach(item => s.add(item)); Array.from(s);
@KarelG ["Coffee","Ice Cream","Lemon","tea","coco"] Logged: ``
or use the first option (.filter + includes)
or better with reduce
||> let a1 = ['Coffee', 'Ice Cream', 'Lemon']; let a2 = ['tea', 'Ice Cream', 'coco']; a2.reduce((arr, item) => { if (!arr.includes(item)) { arr.push(item); } return arr;}, a1); a1;
12:17
@KarelG ["Coffee","Ice Cream","Lemon","tea","coco"] Logged: ``
||> [...new Set([...['Coffee', 'Ice Cream', 'Lemon'], ...['tea', 'Ice Cream', 'coco']])]
@BenFortune ["Coffee","Ice Cream","Lemon","tea","coco"] Logged: ``
or .flat()
12:56
So, I just created this canvas script as part of a little script I was making to convert Paragraphs to little PDF Images (Im just converting them to PNGs)
and it doesnt seem to recognize .toDataURL();
var tCtx = canvas.getContext('2d');
 tCtx.canvas.width = tCtx.measureText(this).width;
 tCtx.fillStyle = "white";
 tCtx.fillRect(0, 0, canvas.width, canvas.height);
 tCtx.fillText(this, 0, 10);
 image.src = tCtx.toDataURL();
 document.removeChild(canvas);
|| mdn canvas.toDataURL
It did for a while, and then once I added the fillStyle to make the background white, it no longer functionioned
you are calling it on your renderingcontext object
not the canvas object itself
Karel you are sniping me >.>
12:59
Still new to canvas..
I dislike its unproportional prototype design... stacking things with line breaks to make code
You got this Taylor \o/
no selectors or variables
lol Its just a strange concept, Im used to being able to place elements inside each other in programming, or atleast selecting different values, code, and executing where I want when I want using Classes, functions, variables, etc
but canvas is just.... wierd??
13:25
Why isnt my canvas height changing based on text height?
 canvas.setAttribute('style','position: absolute; left: -10000px; height: auto; display: inline;');
I have it set to inline and height auto
it should be changing its size based on the text inside of it, but its still like 200px tall
no other effecting stylesheets
@TaylorS ew
don't use setAttribute('style')
|| mdn element.cssText
Easier than writing a ton of style.effect = "blahblah";
13:27
look at cssText
Anyways, I need help with my Problem, not how the code looks
Please give a mcve with a fiddle or something.
Great job on the MDN command JBis! I always wondered why there wasn't something like that in Caprica (similar to OakBots /javadoc) and I am really happy to see something like this implemented here :)
Isnt there an MDN command in caprica already
I thought there was
Thanks! I think cap had it originally but it broke and was never fixed.
13:31
then again, rLemon murdered my permissions to use caprica after I... actually I forgot why
Ooh.. I wonder... Actually, Uh, JBis?
Can you use Font Smoothing in canvas :3
or is that a CSS only feature
Cap's dead anyways, isn't she?
Pretty sure rLemon is too
One day he disapeared, Caprica turned off, and I havent seen him since
Wonder what happened to him :P
haha, he's fine :D
we moved, basically
13:36
rlemon is alive. He just doesn't come to js chat.
??
Oh I see
Nevermind about my question above, I found a text legibility thing for canvas
Actually, Sorry, one more question, if I want to set the background to white, and the text to black, wouldnt the Canvas Stack be somewhat like this?
tCtx.fillStyle = "white";
 tCtx.fillRect(0, 0, canvas.width, canvas.height);
 tCtx.fillText(this, 0, 10);
 tCtx.fillStyle = "black";
I tried that but it doesnt seem to change the text color, only the canvas background
OHHH i see, you place the fillstyle behind the property
 
1 hour later…
14:48
after more than 15 years javascript.. I have to admit, that I still don't understand promises
let createStripeIntent = async () => {
  const paymentIntent = await stripe.paymentIntents.create({
    amount: 1099,
    currency: 'usd',
  });
  return paymentIntent;
}
/// result
> createStripeIntent()
Promise {
  <pending>,
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] } }
let clientSecret = createStripeIntent().then(promise=>{ return promise.client_secret})
>getClientSecret
Promise {
  'pi_1Fj5It2eZvKYlo2CFzugZkMH_secret_EvtBelHSzAsnnpwzx2LoZ3AXj',
  domain:
   Domain {
     domain: null,
     _events: { error: [Function: debugDomainError] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [ [Object] ] } }
after 2 yearsr of javascript... I only understadn how to use await sleep :3
how to get that damn string?
Omfg my typing
I only understand sleep..
I need it right now!
Seriously, thats the only promise I understand or even remember how to use
14:52
@Suisse let clientSecret = await createStripeIntent()
You can't "return" the value out of a chain of promises to your synchronous code, any more than you can return the value out of any other async callback
but you can use await to make it seem like you can
u can only use await in a async function
so I need a anonym async function just to call that?
That won't help you return the promise to your non-async functions
You can't do that
If you want to consume the value of an async method you need to design your code around callbacks.
    @Suisse

    function sleep(s) {
     return new Promise(r => setTimeout(r, s));
   }

    async function SuisseNeedsSleep() {
     await sleep(10000);
     WakeUp();
    }
@TaylorS Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
14:57
haha
To clarify, this is wrong:
let clientSecret = createStripeIntent().then(promise=>{ return promise.client_secret})
This is right:
createStripeIntent().then(clientSecret =>{ /* do something with clientSecret */ })
I need sleep too:
 if (this.includes("\n") == true) {
  var ln = this.split("\n");
  ln.forEach(element => function() {
   tCtx.fillText(element, 0, 20);
  });
 } else if (this.includes("<br>") == true) {
  var br = this.split("<br>");
  br.forEach(element => function() {
   tCtx.fillText(element, 0, 20);
  });
 }
two pots of coffee at 9:50 am at school
Im jittering... literally
Im like trying to make my own multiline engine for canvas lul
let createStripeIntent = async () => {
  const paymentIntent = await stripe.paymentIntents.create({
    amount: 1099,
    currency: 'usd',
  });
  return paymentIntent;
}

let getClientSecret = async function(){ return ( await createStripeIntent()).client_secret}
so not working neither
No, I said it wouldn't
Read above
@meagar
15:03
If let getclientSecret is in a sync function, it cannot get the client secret. That isn't how JS works.
but this is also not doing it
createStripeIntent().then(clientSecret =>{ /* do something with clientSecret */ })
Ima go take a post assessment in IT... cya guys in a couple minutes
Good luck and stuff
Oh one more thing Suisse
createStripeIntent().then(clientSecret => function() {

});
try that instead
Guess im actually here for a couple more minutes, Test takes forever to publish on our bad school wifi
@TaylorS that makes no difference
x => { } and function (x) { } are equivalent in this case in any browser that supports arrow functions
15:10
Oh Alright, I just find labeling it as a function and then opening it up, tends to add a bit more readability
(async () => {
    let createStripeIntent = async () => {
        const paymentIntent = await stripe.paymentIntents.create({
            amount: 1099,
            currency: 'usd',
        });
        return paymentIntent;
    }
    let pro = await createStripeIntent()
    let clientSecret = pro.client_secret;
    console.log("Tadaaa", clientSecret)
})();
now its doing it
nice
So what are you making? A Payment system?
...

I just suddenly got the urge to make a working Car Engine model using JS and CSS
.-.
I guess thats my next project XD
I think I did an engine model a couple years ago
Wonder how tough itd be to make one out of HTML and css and make it function
lol
Nah, Too much code for rigid bodies
would have to use Canvas
Would be a cool final grading period project for Programming Class
Yup, nevermind, way out of my league, anyways bye guys
 
2 hours later…
17:39
@TaylorS yeah just a simple stripe credit card payment implementation for my newst "startup"
use three.js/physijs for that
 
3 hours later…
20:32
 html += '<label for="client_bitmex_apikey[client' + pos + ']">';
is this correct way to do it? I get lost with ' and "
that is one option
Alright nice
 html += `<label for="client_bitmex_apikey[client${pos}]">`;
is another
np, also no need to star answers unless theres a reason :)
20:36
yea the second one is better
i thought its there as a thank you :D
Its more for jokes, something cool, or announcements but np :)
 
1 hour later…
22:01
Hi friends !
It is possible to make JSONP request from Server side?
'cause I'm trying with axios, and does not works. Always is saying: ReferenceError: document is not defined
kinda... but that's weird
you can make an http request from the server that receives jsonp (which is json wrapped in a function call), but that would require you unwrapping it before parsing it as json.
if the endpoint supports json, you should just use json
the endpoint does not support json
the endpoint returns something like:
callback( { data: 'something...' } )
with invalid json?
valid json
yeah, best bet there is to remove the callback( and trailing ) then jsonparse it
22:08
Yes, I was thinking that
something like
JSON.parse(mAxios.data.replace(/\(|\)|callback/g, ''))
23:02
there's a event called onversionchange for indexedDB, developer.mozilla.org/en-US/docs/Web/API/IDBDatabase/… says that i need to refresh the page or use the new opened tab (after update db), but when i refresh the page the browser does not use the new version of db. It works this way? Or i need to implement some kind of logic to tell the browser to use the new version on refresh?

« first day (3328 days earlier)      last day (1845 days later) »