« first day (2245 days earlier)      last day (2696 days later) » 

8:00 AM
NPM is a much better platform and you can stitch together things just as easily... I guess no one likes monolithic frameworks that are really opinionated (Meteor >.>)
but I still get people pulling me by the sleeve to get something like passport integrated with koa or express, because they have to ship by Friday
 
npm has a weak side
project devs are importing many dependencies on the fly if they need a solution to their problem
remember the left pad drama ?
 
wow, there's just so many frameworks to even know about. :D -- meteor, koa and express I don't think I've ever heard of.
@KarelG was the node_modules folder getting huge quickly one of the problems? -- cause that's something I've been kind of surprised by. tens of thousands of files, over 50 mb...
 
@Julix No, a module was straight up removed from the central repo, breaking thousands of builds
 
@ivarni sorry what? when did that happen? I was working with a modules folder like a week ago!
 
the Jenga tower of JavaScript ^^
 
8:04 AM
there was an intellectual property conflict over a package name that brought down everyone's builds, but it's been resolved by now
 
@ivarni awesome article, thanks for sharing! :)
 
@KarelG though that does seem to be the point... look at substack and other NPM heavyweights, they'll throw in a package rather than writing 20 LOC if it's well maintained by someone else
 
@FilipDupanović and I guess that's the warning of the story. the advantage is you don't have to maintain that, someone else does. (mostly. -- but then also they might not or fuck it up)
 
I've opened PRs to open source projects to fix bugs without getting a single comment in months so the "someone else will maintain it" idea doesn't always work
 
you need to go to the package repository and get an idea if it's well maintained; if so, you just need to add something like greenkeeper.io or bithound.io if you don't have the time to run npm outdated and every once in a while make sure everything is up to date
 
8:08 AM
I'm more careful about what I pull in now... look at the activity on github, have a glance at the issues page and the number of PRs before setting up a dependency
 
@ivarni can't you pull it once at the start of the project and just ignore future updates? i.e. keep a local copy? or does npm not allow that?
 
@Julix You can absolutely do that if you want
 
@ivarni problem with open source projects is that the maintenance of it has ended, leaving you with unmaintained code after 5 years
 
@ivarni I can't find the gist by substack, but yeah, that's what he does: check the README, check if issues/PRs are getting closed, check that dependencies are being updated, check that the package has some dependents
 
i'm currently co-engineering with the dev team to cleanse our client side scripts from dojo / dijit frameworks
 
8:10 AM
@KarelG that happens to some projects, yeah, but that's a problem with those projects and not open source itself
And closed source framework suffers from the exact same issues
except you can't fork and fix them yourself
 
@KarelG Was wondering why it not being maintained would be so bad, if it works well, but I forgot that modules can come with dependencies... so if you want something that's not maintained anymore (just keeping your own copy) but it requires another module that you do want to use and keep updated, but it requires the old version then I imagine things can get messy... haven't had that yet
@KarelG dojo I've heard before somewhere somewhen, dijit I haven't. -- if I want to work as entry level front end, how important is it that I know (of) as many frameworks as possible, versus knowing a few well?
dojo = "A JavaScript toolkit that saves you time and scales with your development process. " (wow, so specific... it saves you time, eh? -- dijit = widget system...
 
that's now a lie :P
 
alright, so it claims to do everything you need for a web app... anyone here use dojo?
 
it's very hard to convert to native code. We've discussing that so hard across 4 meetings so far
don't use dojo anymore
 
The problem with frameworks that does "everything you need" is that they try to do everything you need
 
SRJ
8:17 AM
@Mr_Green
how can i know whether the user clicked cancel or close button of a confirm box
 
so did it do MVC?
@SRJ why do you want to handle them differently? -- the expectation is that they both cancel whatever the confirm was about, right?
 
@KarelG yes it isn't linear but I just needed a figure to understand the max battery life approx.
 
SRJ
for me OK-means print all pages (true) cancel - means(false) print specific pages --- close means do nothing @Julix
 
thanks for peukert effect :)
 
@Mr_Green but this doesn't take into account how much the machine itself takes up... like if you have a phone running as a media player, then the headphones are going to be the smalles issue. even if you turn volume to 0 you'll burn out pretty fast. listening quieter will make a nearly negligible difference in battery life, right? and in a normal sound system the amplifier would be using up a lot of the electricity, no?
@SRJ maybe make a custom box then... modals they're called! :) in there have 3 buttons "print all" "print selected" "cancel"
 
8:24 AM
yes I agree
I know why they mentioned battery life for 75% instead of 100% because they know people repel for lesser values.
The value could be lesser/greater than the one we get by considering it as linear.
mostly not greater..
anyway @Julix how you end up to 12/(100 / 75) ?
I was doing all this time 12/ (75 / 100)
 
I did an example where I assumed I knew how much energy was available and what the consumption rate was, and then calculated how long it would last; after that I calculated how long the same would last if it was only using 75 % (i.e. 3/4) of the consumption rate. From there I calculated what the ratio is between the 75% amount and the 100% amount (i.e. it's 1.33 in the from .75 to 1 direction)
I'm sure there's a better way to do it, but that was the best I could think of.
Given that you're saying it's linear it wouldn't matter what my assumptions were about how much energy I started with, or what my consumption rate is, because that would be the same between the 100% and the 75% version. I managed to reduce it to the ratio...

hahaha I could have just done 100/75 and gotten the ratio that way. lol
 
yeah I thought you did like this only :)
 
SRJ
yea.. @Julix its fine.. but i just wanted to know if its possible to differentiale a close and cancel
 
oh what you're trying to do works too, if you multiply instead 12 * 0.75 = 9
 
yeah
and then I was curious why you flipped 75/100
 
8:33 AM
I could ask you why you flipped it :P
 
you mentioned 3/4 which is the least ratio of 75/100.. so I assumed you might have started from there
 
user3119231
anyone of you know nic nacs?
 
@Mr_Green multiplying by a fraction is the same as dividing by the flipped fraction -- that's why I got to 4/3
 
eh, today it's first time that intellij's code inspection is failing
 
hmm ok
 
8:37 AM
 
x energy (total available) * y hours / (per) (1 energy (consumption) * z (usage ratio)) = xy/z hours

so the units decided where I would divide or multiply
 
i should put a contract because i know some co-workers that rely too heavy on code analyzers
 
@ivarni oh let's move from React to X! damn, X is missing some great package React had, abort!!!
 
@KarelG I can't parse that sentence. - your screenshot shows the code analyzer tool in some IDE. some people heavily rely on it. what does that have to do with a contract?
 
The crazy [MDN page](developer.mozilla.org/en/docs/Web/JavaScript/Reference/… ) suggests that Array.slice can be used to create initialized arrays instead of slicing them!
 
8:43 AM
@Julix never heard of design by contract ?
!!tell Julix wiki Design by contract
 
Array.prototype.slice.call(1) creates [] when I try it but if we wrap this call into a bind(null, 37) then it will create [37]. What the hell?
 
if you specify it, then coworkers wouldn't mess with methods that has very complex instructions
 
!!> a = []; a.length = 10; a
 
@FilipDupanović ["undefined","undefined","undefined","undefined","undefined","undefined","undef‌​ined","undefined","undefined","undefined"]
 
8:45 AM
I think that's the trick ecmascripten uses to initialize arrays
 
@KarelG You must have just started using it
 
i don't pay lots of attention on it, but that yellow background box around it got my attention, so i checked it
 
@KarelG I just now realized that contract here is a metaphor, not the same as freelance work :D -- the wikipedia link was useful, but also indicative of how I'm starting to burn out, it seemed hard to read. -- I'm assuming normally it wouldn't
 
"JavaScript: From Journeyman to Exhaustion"
 
bahaha, a class that has a contract with anything that wants to interact with it :D - "sorry you don't meet the pre-requisits to call me"
 
8:55 AM
How do you use slice, particularly, list = (...args) => Array.prototype.slice.call(args) to initialize an unexisting array? developer.mozilla.org/en/docs/Web/JavaScript/Reference/… suggests that you need l33=list.bind(null, 33) for that. ` l33()` creates a [33]. Why does slice creates an new, initialized array?
 
"Guarantee a certain property on exit" -- hm... that does sound like something classes should do. Okay, I think I like the metaphor. thinking about it that way might help make sure that the mutual obligations of the pieces are met...

but what I don't get is how this would be implemented. "JavaScript, via AspectJS (specifically, AJS_Validator), Cerny.js, ecmaDebug, jsContract, or jscategory." hm...
 
Is ECMA 6 out ?
 
In 2015, it will be out
 
How can I learn some JS if I do not understand that? I read in MDN that Array.slice is used to cut pieces from existing array. Why do they use it to create initialized array from nothing?
 
@LittleAlien that is hack.. don't use that without understanding basics
 
9:00 AM
@FilipDupanović "JavaScript: From Journeyman to Exhaustion. Tome 1 of NaN". :D
 
@Mr_Green so its out. Thanks
 
@LittleAlien If you want to learn some JS learn something else. If you want to learn that specifically, buckle down, cause it looks hard
 
@Julix word!
 
lol :D
 
@shakylmansuri Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
9:02 AM
@shakylmansuri $.master();
 
@BenFortune lol :D
 
@shakylmansuri "how can i get master over js or jquery?" - that depends which master... but even then. jQuery is not a place, so it'll be hard to get them over it... :D
 
anything else guys??
 
@shakylmansuri what's your current level? -- because there aren't really magic tricks. getting mastery over anything requires getting fundamentals down first. There's a tremendous amount of resources for that nowadays.
 
i have just started to learn jquery
 
9:04 AM
Do you know JavaScript?
 
I can say I am at basic level
yes i know Javascript
 
@shakylmansuri what do you mean by "you know" -- how well?
 
I think the question is "Do you know Javascript well enough to write your own framework ?"
 
@FlyingGambit yup :P
 
@FlyingGambit not really, because I could google how to write a framework, and do it (isn't it basically just another javascript file with helper functions). It just would suck horribly. :D
 
9:07 AM
No, I am working basic level in javascript like functions variable
 
@shakylmansuri jQuery is just a library to provide normalization for DOM
 
@shakylmansuri alright, basic jQuery and basic JS are a great start.
 
It's generally recommended to have a good understanding of the DOM before jumping into jQuery.
You don't have to know all its nooks and crannies, but you should know what the DOM is, how to find elements in the DOM, how to make changes to elements in the DOM, etc.
Once you know that, understanding what jQuery does it much easier.
 
nooks and crannies hmm
 
@MadaraUchiha yeah, because otherwise it can be painful to learn the dom. if you don't know anything yet and you learn to create and manipulate child nodes etc - changing things around, that can feel awesome. but if you already know jquery you just keep thinking "why is there no nth sibling? why is selecting stuff so much more inconvenient? chaining? "
 
9:10 AM
!!urban nooks and crannies
 
@Mr_Green No definition found for nooks and crannies
 
@Mr_Green Risky search of the day
@Julix It's all fun and games until you have to debug events.
Then you're royally screwed.
 
How did you know this combination? just curious :D
 
To be fair though, many people have learned jQuery first (how to use it, not really to understand it) and then learned javascript after to learn what it really does etc...

I recommend http://codecademy.com for JavaScript... they have old courses too that are hidden, but you can still do them, so that way you get a fair bit of JS practice
 
egghead is providing free vuejs tutorial to limited time... only 16mins
 
9:13 AM
@Mr_Green lol, freaked me out for a sec. thought it was only 16 min left for the deal - but it's 16 min of videos. where does it say it's only temporarily free?
 
hehe I got mail yesterday
vuejs looks nice
 
what is Vue anyway? resurrected jQuery?
 
@FilipDupanović I think it's an MVC - supposedly easier
 
resurrected Backbone?
 
@FilipDupanović Resurrected Angular 1.5
 
9:16 AM
@Julix MVVM, it's closer to Angular
 
@BenFortune "Model–view–viewmodel" WTH? -- en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel -- to tired for this tonight :D lol
 
I am tired of this frameworks. I will create my own..
 
@Mr_Green I am gonna create my own Javascript
 
name it JavaScript 2 to confuse devs as google does
 
@FlyingGambit I'm going to create my own sleep sometime soon, I hope... or at least my own homework. somehow I'm doing neither... is there a function for that? -- no way! there is:
close();
 
9:20 AM
@Mr_Green lol
 
see y'all! - thanks for the conversation and good night, or good day if that's what it's over there.
aww! "VM406:1 Scripts may close only the windows that were opened by it."
 
Good Night sweetdreams.js
 
Now I'll never make it out of here.
 
@Julix setTimeout(wakeup, 30000);
@Julix good night
 
@Mr_Green What, nooks and crannies?
 
9:21 AM
he will wakeup because wakeup is undefined :P
 
I read books
 
yeah great
 
@FlyingGambit With blackjack and hookers?
 
any book to recommend? I like thriller, romance, comedy categories
 
I'm glad small farmers are now using the internet, but someone has to help them with marketing and comms before I get myself flagged: "Hi! I'm slaughtering at homes, if you have anything to arrange, please let me know. Thanks!"
 
9:22 AM
@MadaraUchiha It will be the most sexy JavaScript ever
 
@Julix while (julix.isConscious) { desk.apply(julix.head); }
 
@MadaraUchiha I thought it was crooks and nannies
 
@FlyingGambit seriously? half a minute of sleep? how generous! :D
 
@Julix Thats all you get, chop chop get back to work :P
 
developer.chrome.com/extensions/tabs - okay, so it is possibly to close this tab with script... I just need to get into the chrome api somehow
 
9:28 AM
go to sleep.. tomorrow is waiting for you
 
I console logged chrome and found that object exists. got me excited. but then I couldn't find the tabs property there. so yeah, giving up.
manual click will have to do
 
@Julix Go to sleep, rainbow ponies are waiting for you
 
go to sleep.. trump as president waiting for you
^ makes no sense
trying to be poetic even being aware that I suck
 
go to sleep
trump is president
he is waiting for you
we can keep forking this until we get smt
 
we can keep forking this until we get something
 
9:37 AM
(how many room 17 members do you need to write a poem?)
 
17?
 
Note to self: If you want to reach the TypeScript repl, do not google for "ts playground".
29
 
I am equal to 17.. just saying
I once searched for "C string" while learning C
OMG.. just searched now.. lol
someone should include this as cons of TS
 
@Julix Extension only API
 
9:52 AM
OMG Where is the filter bubble when you need it?!
 
@SRJ jsfiddle.net/Julix/tq9bLrzy/1 -- in case you're slightly interested in the modal thing, here's a working example.
 
@MadaraUchiha I was curious, now I'm not.
 
My curiosity killed me cus i tried googling "ts playground" :/
 
oh yeah, I totally had this closed, but then I started having to close tabs... just read my way through the npm thing that was talked about before. really interesting. ok, jsfiddle is shared... rest is bullcrap - alright. gone :D
 
> remove children with ts
> chain children with ts
 
9:58 AM
@littlepootis omg feeling proud codegolf.stackexchange.com/a/102490/4257
 
@MadaraUchiha Goddamnit.
 
@Cerbrus People will believe in an invisible man in the sky, but when told not to google something, they just have to test it out
 
@FilipDupanović Doesn't it actually have to run?
 
@MadaraUchiha People that don't believe in the man in the sky may be more inclined not to believe you ;-)
 
@littlepootis how do I access Hangouts on this animation box from firefox? I don't want to signin to the hangouts app...
 
10:02 AM
what's a package "signed for this afternoon" mean?
that it's guaranteed to arrive this afternoon?
 
@towc That sounds like it's already been signed
 
+1 for hand-drawn red circles. I wouldn't have noticed the code blocks without them. — Cerbrus 13 secs ago
Oh meta...
 
@BenFortune yeah, but what does it mean?
 
That it's been signed for...?
 
@towc: That someone signed to receive the package
In other words: It's delivered
 
10:05 AM
oh wut
 
@BenFortune nooooo REPL fart :'((((((
 
that makes absolutely no sense
> Hi, We have reprinted your order and will go out first class signed for this afternoon.
 
Wat
Is that en e-mail?
 
yes
 
It's a royal mail delivery option
 
10:06 AM
and what's it mean?
 
Signed for means you need to sign for it.
 
> Hi, We have reprinted your order and will go out first as "signed for", this afternoon.
 
the sender signed for it?
 
Maybe that's what they meant?
 
It can't just be posted through a letterbox, someone needs to be available to receive it and sign with a signature.
 
10:07 AM
hummm
ok
I guess
 
@MadaraUchiha ...fuck
 
@BenFortune oh, I see, thanks
when I first googled it, it made no sense
 
@AwalGarg Another one bites the dust xD
 
SRJ
@julix thankyou so muchhh :)
 
10:14 AM
Hi, anyone know how to detect a browsers forwards and back buttons click events?
 
@JacksonSentzke Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@Knu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
@JacksonSentzke i think that you need to look into popstate
!!tell Knu mdn popstate
 
@Knu Something went on fire; status 403
 
the future of javascript.. stackoverflow.com/a/41036850/1577396
 
Knu
example = {
a: test1(),
b: test2()
};

Can you be sure that all implementations exec test1 before test2?
 
10:17 AM
 
@Knu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
Knu
I used ctrl-k oO
 
@HatterisMad
 
@Isuru Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Hello everybody
 
10:18 AM
Ctrl K + C
 
@MadaraUchiha :,)
 
Anyone here can help me with a problem on ionic framework ?
 
whats the issue @gtzinos
 
@Knu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
@Knu Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
i add an element with position:absolute;z-index:9999: top:0 ; right: 0; and is hidden...
 
10:20 AM
@Knu paste, CTRL+K, enter
@Knu Yes
 
Knu
let's try again then but I did exactly that :)
 
the only solution is to change the class .pane, .view { z-index: inherit; position: initial } but it will broke my design
 
Knu
OK then it's the order that matters my bad
if you use shift-enter in between it fucks it up
 
@Knu Yes, you can't uncode anything
 
10:22 AM
@KarelG Like this?
    window.addEventListener("popstate", function(e) {
        backButton.onclick = function() {
            console.log("Back");
        }
        forwardButton.onclick = function() {
            console.log("Forward");
        }
    });
 
@JacksonSentzke Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq.
 
do your code stuff and text, and at the end, press Ctrl+ K before enter
 
A message is either code or not code in chat.
No in between
 
I pressed CTRL + K
 
@JacksonSentzke But then you tried to remove the spaces from a line
Either they all have 4 spaces, or it doesn't work.
 
10:23 AM
kk
 
guys anyone can help ?
 
Knu
k thx > back to my question you can't be sure on how a for in loops but the property order is respected in a {} declaration
that's interesting
I am too lazy to test my hunch
thx @MadaraUchiha
 
@Knu Usually, you can count on it being the order of insertion
But you shouldn't.
 
Knu
I shouldn't?
 
@Knu It's non-standard, but everyone implicitly do it
 
Knu
10:26 AM
I was thinking of switching to a.b =;lines just to be on the safe side
 
@Knu What exactly are you trying to do?
 
the standard says it will be inserion order unless keys are numeric and a length property exists
 
Knu
I create an object and it's properties ~at the same time
but one of the property requires one of the other to exists
so the order counts :)
I find it more pleasing to the eye and internally I am sure it's better for performance because the length is set only once…
 
!!> while(x=[x,x=0]);
 
@FilipDupanović "ReferenceError: x is not defined"
 
10:34 AM
@Knu There's no length for JS objects, only for arrays and array-likes
 
Knu
@MadaraUchiha internally (Gecko and the like)
 
Also, for properties that are computed based on other properties, it's best to use a getter
const person = {
  firstName: 'Madara',
  lastName: 'Uchiha',
  get fullName() { return `${this.firstName} ${this.lastName}`; }
};
 
Knu
example = {
      a:     test1(),
      b:     test2() // depends on example.a
};
 
I have recognized that ECMA6 is the future. its so awesome my glowy eyes twinkles
 
@Knu For starters, your functions should ask for what they need in the arguments.
If your test2() function relies on example.a it should have an argument in which you pass it in.
 
Knu
10:37 AM
example is global
 
@Knu Doesn't matter.
 
Knu
oh you mean as a common practice
 
The fewer global dependencies you have, the better you're off.
It will come back to haunt you, repeatedly, months/years from now.
 
Knu
well not global, higher-scope variable
 
var weather ={
  apiKey : "superawesomeapikey",

  dataArray : [],

  init : function(){
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = this.testInit;
    xhttp.open("GET", "skippysuperawesome.html", true);
    xhttp.send();

  },

  testInit : function(){
    if (this.readyState == 4 && this.status == 200) {
      var obj = JSON.parse(this.responseText);
      this.dataArray.push(obj);
      this.appendToPage(obj);
   }
 },
   appendToPage: function(jsonResponse){
     var testEle = "<p>" + jsonResponse.name + "</p>";
sorry to ask for help again but i'm missing something obvious again
i get this error caught TypeError: this.appendToPage is not a function
 
10:42 AM
that fully depends on how you invoke that method, so you would need to paste that part of your code where you call it.
 
also i get the same error on the dataArray.push method
 
xhttp.onreadystatechange = this.testInit.bind(this);
 
var test = Object.create(weather); test.init();
i call it in another file
 
also learn using fetch
gosh XMLHTTPRequest makes my eyes bleed
 
Knu
let him do whatever he wants
you dunno his/her target browsers
 
10:44 AM
what does that bind do in this case?
 
binds the function
 
see Abhishrek's line, you need to bind the context
 
I am so happy this works in Chrome now :D
 
why is it necessary if its inside the same object?
 
Knu
@Abhishrek well you don't have .formData() yet
 
10:45 AM
onreadystatechange will eventually get called by the interpretator, and it gets not invoked by your object. That means, the this value will not reference your object then
 
  async function test (domain, client_id, client_secret) {
    const resp = await fetch(`https://${domain}/oauth/token`, {
      method: 'POST',
      headers: {
        'Accept': 'application/json',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        grant_type: 'client_credentials',
        client_id: client_id,
        client_secret: client_secret,
        audience: `https://${domain}/api/v2/`,
      })
    });
    const tokens = await resp.json();
    console.log(tokens);
 
@Abhishrek 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 gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
 
that seems weird @jAndy
 
@Proxy not at all. This will reference the XHR object, not your object. You need to bind it to your object (instance) manually because you don't call it yourself
but you might get a problem with your condition then... this.readyState might fail after binding to your instance
 
so inside the initTest function this refers to the xhr object?
 
10:50 AM
yes if you don't modify the context with .apply, .call or .bind it will default reference the xhr object
 
yup now readyState is failing to bind
 
so now you need to write that xhr object into your instance object on init call. Like this.xhttp = new XHRHttpRequest(); and then just access it via that reference
 
Why won't jshint not report this as an error?
var orders = {
  orderId: {
    type: 'string',
    size: 6
  },
  customerId: customer.customerId
};

var customer = {
  customerId: {
    type: 'string',
    size: 6
  },
  contactName: {
    type: 'string',
    size: 25
  },
  $key: ['customerId']
};
Where as if you execute this code in jsfiddle it throws an error
 
@deostroll Because it doesn't check for the problem?
Or maybe it's just broken
Who knows
 
hi people
 
11:00 AM
hi @Mathematics
 
@jAndy sorry to bother you but how should i define my xhttp? I did this xhttp : undefined
and alter inside init function this.xhttp = new XMLHttpRequest(); but i get the undefined error for xhttp
 
how does relative div inside another relative div behave ?
trying to understand css positioning
 
@FlyingGambit like relatives ?
 
@Mathematics how ?
or does it behave statically ?
 
@FlyingGambit create a JSFiddle
 
11:05 AM
bye all
@Mathematics lol if i had the time i would not have asked here :D , anyways thanks , I am out of time gotta run
 
@Proxy something like this: jsfiddle.net/w1atn8gp
 
> trying to understand css positioning
> if i had the time
So you expect to understand CSS positioning by quickly dropping into chat for a few minutes?
JS chat at that
 
@jAndy yeah it works now thanks. But now my question is why and how does it work? I mean you have not even declared a variable you just put this.xhttp. That automatically creates a variable i guess, but how does it transfer it to the the callback function
sorry to spam you :/
 
@Proxy we don't declare anything, we just create a new property on the "instance" (don't get confused by this, we're not actually dealing with classes here) object you created by calling Object.create()
the second init() gets called, we create that new property. At that point, this references an object
 
11:27 AM
so in every callback this is bound to the "callback object" by default, xhttp in this case
 
the tricky part to understand is, that the this reference can change. Usually it depends on how a function gets invoked. For instance, calling SomeObject.fnc();, the this will always reference to SomeObject. To change this behavior, we have the options of Function.prototype.call, Function.prototype.apply and Function.prototype.bind.
In your example, you passed a function reference to the XHRs property onreadystatechange. The browser will invoke that function at some point in time automatically, but it calls it in that way, that this will reference the XHR object itself.
 
and everything outside that function that was declared in my object is out of scope?
 
and we intercept that this, but calling .bind() on the function reference. After that call, the context will be frozen for all times to whatever you set it. In this case, your own object reference
there isn't much to "scope" over in this example. It just about accessing the right object reference.
 
eh js is werid
 
nah, once you know the rules it's totally straightforward
 
11:39 AM
eh i hope so i never done it besides some form checking, simple image gallery etc but would like to learn it now since it has become the "number 1 language"
 
but the prototype stuff and callbacks are giving me problems i must admit
thanks for your help once again
 
11:50 AM
Is anyone here aware of any active Gitter room?
It seems like everyone is slapping a gitter badge on their repo, but nobody is actually using the service
 
I sometimes hangout in the #FreeCodeCamp/HelpJavaScript room.
 
I have a quick question: I'm trying to avoid a callback hell when using "third party" functions. For example when using fs.readFile how can I pass extra arguments to the function so don't lose scope.
 
@user1640736 Welcome to the JavaScript chat! Please review the room rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
Or are there any better pratices for what I'm trying to achieve
 
@Proxy if you find js weird, you should try this: factorcode.org
 
11:55 AM
thanks, but no thanks
js is all i need
as a side note definitely don't google "ts playground" at work place
 
I mean, I can think of worse things to google
 
hit it
 

« first day (2245 days earlier)      last day (2696 days later) »