JavaScript stream_context_set_default
!No description available for stream_context_set_default. @php.js developers: Please update the function summary text file.
1 2 3 4 56 7 8 9 1011 12 13 14 1516 17 18 19 2021 | function stream_context_set_default (options) { // !No description available for stream_context_set_default. @php.js developers: Please update the function summary text file. // // version: 910.813 // discuss at: http://phpjs.org/functions/stream_context_set_default // + original by: Brett Zamir (http://brett-zamir.me) // - depends on: stream_context_create // * example 1: var opts = {http:{ method:'GET', header: 'Accept-language: en\r\nCookie: foo=bar\r\n' } }; // * example 1: var context = stream_context_set_default(opts); // * example 1: get_resource_type(context); // * returns 1: 'stream-context' // BEGIN REDUNDANT this.php_js = this.php_js || {}; // END REDUNDANT if (!this.php_js.default_streams_context) { this.php_js.default_streams_context = this.stream_context_create(options); } this.php_js.default_streams_context.stream_options = options; return this.php_js.default_streams_context;} |
Examples
Running
1 2 3 | var opts = {http:{ method:'GET', header: 'Accept-language: en\r\nCookie: foo=bar\r\n' } }; var context = stream_context_set_default(opts); get_resource_type(context); |
Should return
1 | 'stream-context' |
Dependencies
In order to use this function, you also need:
Open syntax issues
php.js uses JsLint to help us keep our code consistent and prevent some common bugs.
Eventually we want all code to pass or at least take into consideration most fixes suggested by JsLint, following this JsLint configuration we’ve decided on.
Authors
Thanks to the following developers, you get to have stream_context_set_default goodness in JavaScript.
No comments yet. Be the first!
spread the word:
Use any PHP function in JavaScript
These kind folks have already donated: Anonymous and Shawn Houser.
<your name here>