-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Notporting" Functions #37
Comments
Although I think Kevin wanted to make php.js a primarily client-side library, he has always been open to our storing functions in the experimental section (or allowing configuration coordination via the php_js global, so someone could call ini_set() say to specify a server-side environment). So, yes, unless Kevin has objections, I'd say absolutely, at least for adding to the experimental section or adding support via configuration. Though I hope it may be possible to implement with CommonJS (though without knowing much myself, it seems one would have to choose between synchronous and asynchronous APIs?) |
Yes I think setting environment and having functions error out if it is not compatible is the way to fly. |
I'm thinking node.js should be 1st class citizen. I released this npm even though many functions still target browser apis. Hence some uglyness. But if it where up to me, all things echo default to console.log, all things file default to the fs module. And only if we detect those are not available to we do a stab at browser compatibility. e.g. using sync ajax for a file_get_contents is just a mistake and allows beginners to do terrible things. But in having it in serverland would allow you to run |
FYI, our file_get_contents(fileName, null, {// You can create this "resource" in a more PHP way by calling stream_create_context() here instead
// stream_options: {http: {}}, // Now optional as in PHP
stream_params: {
'phpjs.async': true,
notification: function () {
if (this.readyState === 4) {
alert(this.responseText);
}
}
}
}); ...though it is not the most beautiful bird out there: :) I surmise even the phpjs.async custom arg might not be necessary if the flags |
Thanks for reporting, and sorry for the long wait. This project and my motivation were in a bad spot. I recently did a lot of work to breathe new life into it (http://locutus.io/2016/05/announcing-locutus/).
This bit made it into Locutus.
This goal didn't : ) But the good thing is Node is the primary target platform, with Browserify (and similar) as the recommended way to then target browsers. |
With the advent of Node, it seems that many of the "Notporting" functions should now begin implementation. Thoughts?
The text was updated successfully, but these errors were encountered: