« first day (1895 days earlier)      last day (3276 days later) » 

19:02
owait it's tomorrow
Fuck you @MadaraUchiha
@Zirak ?
Isn't it today?
The meeting.
It should be starting soon I think, but I'm not sure anyone is actually here.
It's either now or tomorrow, according to chat.stackoverflow.com/rooms/info/17/javascript?tab=schedule
Scheduling a meeting on Christmas Eve doesn't sound like the best idea.
I think I scheduled it incorrectly :P
I think no one is here anyway since again, it's Christmas eve.
19:04
Hurray
the scheduled event is tomorrow
...I skipped eating pancakes for this
Good thing you did.
if it's today, I'm not gonna be there; too much to do today
not sure if I should be sorry or you should be grateful to me
@BenjaminGruenbaum I gave it a try too: jsbin.com/zeranamuji/edit?js,console,output obviously not even 10% close to the real power of promises (no automatic resolution of promise instances and all synchronous), but I guess this still counts :P
19:11
who schedules a meeting on Christmas
my clock tells me that took 15 minutes. maaaybe I can do a complete implementation in 4 or 5 hours (also cc @MadaraUchiha ^)
communists
@AwalGarg where's error handling and assimilation?
no chaining.
let once = (fns, called) => fns.map(orig => (...args) => called ? null : ((called = true), orig(...args)));
export class Promise {
  constructor(resolver) {
    resolver(v => !this.state && this.assim(v, (s, v) => this._changeState(s, v)),
             err => !this.state && this._changeState("rej", err));
  }
  assim(value, cb, state = "ful") {
    let [res, rej] = once([v => this.assim(v, cb), e => this.assim(e, cb, "rej")]);
    try {
      let then = value && value.then, thenable = typeof then === "function" && Object(value) === value;
Ugly, but 35 LoC and not that ugly.
Probably doesn't work that well.
Fails 12 tests (about foreign thenable assimilation edge cases), passes 860.
Oh, missing Promise._async = fn => process.nextTick(fn);
19:21
@BenjaminGruenbaum wrong link? because it contains the same code as mine :P
@AwalGarg almost the same, look at the example at the end.
@BenjaminGruenbaum yeah, both are exactly the same here:
var x = new $Promise(function (res) {
  setTimeout(res, 10, 5);
});
x.then(function (val) {
  console.log(val);
  return val*2;
}).then(function (val) {
  console.log(val);
});
Oh
var x = new $Promise(function (res) {
  setTimeout(res, 10, 5);
});
x.then(function (val) {
  console.log(val);
  return new $Promise( function(res){ res(15);} );
}).then(function (val) {
  console.log(val);
});
@BenjaminGruenbaum yeah, didn't implement that either :P
But basically I wanted to see how .then could work, and that is one possible solution which can now be polished up.
that's not how then could work since the more interesting part of then is that it's a flatMap.
down to 30 LoC
let once = (fns, called) => fns.map(orig => (...args) => called ? null : ((called = true), orig(...args)));
export class Promise {
  constructor(resolver) {
    let transition = (state, value) => Object.assign(this, {state, value})._resolve();
    resolver(v => Promise._async(_ => !this.state && this.assim(v, transition)),
             err => Promise._async(_ => !this.state && transition("rej", err)));
  }
  assim(value, cb, state = "ful") {
    let [res, rej] = once([v => this.assim(v, cb), e => this.assim(e, cb, "rej")]);
19:31
@AshutoshKumar Welcome to the JavaScript chat! Please review the room pseudo-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.
@AshutoshKumar You google "web page performance" and derived terms (javascript optimisation, minification and other size reducers, http2, compression algorithms, etc), read a lot of things, gain experience with them over time, and then maybe you can get some performance improvements.
are we still room meeting?
@BenjaminGruenbaum I shifted the flatmapping to the internalResolver: jsbin.com/zeranamuji/edit?js,console,output. It works, but does this make any sense?
function $fetch (url, opts) {
	var xhr = new XMLHttpRequest();
  xhr.open(opts.method || 'GET', url);
  xhr.send(opts.body);
  return new $Promise(function (resolve) {
  	xhr.onload = function () {
    	resolve(xhr.response);
    };
  });
}

$fetch('https://crossorigin.me/google.com';, {}).then(console.log.bind(console));
wow, that worked
19:49
@phenomnomnominal oh it's tomorrow
19:59
Hello everyone
I found a very strange bug on Youtube where one video has the old Youtube layout whereas all other videos have the new layout: e.g. youtube.com/…
It shows the old layout on my computer but I don't know if it does on yours?
Tomorrow?
on Christmas?
sorry guys the fams more important than you all lol
3
Here's the link to the strange layout: youtube.com/watch?v=S3PalrfEF4g (apologies previous link did not work)
@Cereal nice man!!
I need 10 more for 2k but I've been annoyingly slow when it comes to buying them
my implementation passed most of the .thens and failed all of .deferred and .reject tests because I hadn't implemented those :P fun
20:48
@Neil lel
Oi @AwalGarg
Why'd you set the meeting for tomorrow instead of today?
That's why everyone (me included) missed it :P
crl
crl
tomorrow makes more sense than a 24th dec
21:15
Why would you schedule a meeting on Christmas?
that is a horrible time lol
 
1 hour later…
22:37
Is there any good js wrapper for online or offline detector? I might use IndexedDB to store offline data and sync back when online is detected.
@Zirak and yet it's true :(
@Loktar the people scheduling it are Jews, what did you expect? cc @BenjaminGruenbaum @MadaraUchiha
got a new keyboard for Christmas, can't wait to try it. it'll have to wait until tomorrow though :(
@FlorianMargaine Want something trivial to do? I want a web-based local gallery viewer. Like I can do npm -g http-server ; http-server or python -m http.server to raise a static http server with directory listing, just a local gallery.
@FlorianMargaine I actually wanted to do it today
@AwalGarg was the one who scheduled it.
22:48
@MadaraUchiha same, most of us are with family for Christmas eve
@FlorianMargaine Neat, the sort-of ergonomic one?
@Zirak yeah, the ergonomic + split one
@Zirak That look like it will only work for Mozilla? There must be a wrapper JS that work for Chrome, Mozilla, and IE
@I'll-Be-Back Check compat. I know Chrome has it, I don't care about IE
There are also suggestions for alternatives at the end of the article.
22:49
@Zirak you can have the gallery with helm and follow mode :P
Zirak Ever used localforage?
@MadaraUchiha at Christmas Eve we eat wayyyy too much. My belly is so full right now.
and we're not even at dessert time yet.
there is still cheese to come before that
and it's almost midnight
halp
@I'll-Be-Back Maybe?
@I'll-Be-Back It's not related
> I want a web-based local gallery viewer
@Zirak your mom doesn't need to appear in web browsers too
@Zirak localforage is for local db (IndexedDB / WebSQL). I think I would use localforage with combination of online / offline js detector. Should work I think.
22:57
@I'll-Be-Back Whatever makes you happy
When it come back online, I would like to sync some data from local db to mysql
@Zirak I don't get what you meant by "sauce?"
Maybe using API request to update to cloud.
Source
@I'll-Be-Back localstorage != indexeddb
22:58
I never said localstorage
local db = indexedDB / WebSQL
I wonder if I can use PouchDB without CouchDB. use PouchDB as a client local DB and and then update to mysql using PHP API
23:16
@ndugger Wow that's perfect

« first day (1895 days earlier)      last day (3276 days later) »