id
int32 0
167k
| repo
stringlengths 5
54
| path
stringlengths 4
155
| func_name
stringlengths 1
118
| original_string
stringlengths 52
85.5k
| language
stringclasses 1
value | code
stringlengths 52
85.5k
| code_tokens
list | docstring
stringlengths 6
2.61k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 85
252
|
---|---|---|---|---|---|---|---|---|---|---|---|
3,800 |
gopherjs/webgl
|
webgl.go
|
BindAttribLocation
|
func (c *Context) BindAttribLocation(program *js.Object, index int, name string) {
c.Call("bindAttribLocation", program, index, name)
}
|
go
|
func (c *Context) BindAttribLocation(program *js.Object, index int, name string) {
c.Call("bindAttribLocation", program, index, name)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BindAttribLocation",
"(",
"program",
"*",
"js",
".",
"Object",
",",
"index",
"int",
",",
"name",
"string",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"index",
",",
"name",
")",
"\n",
"}"
] |
// Binds a generic vertex index to a user-defined attribute variable.
|
[
"Binds",
"a",
"generic",
"vertex",
"index",
"to",
"a",
"user",
"-",
"defined",
"attribute",
"variable",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L398-L400
|
3,801 |
gopherjs/webgl
|
webgl.go
|
BindBuffer
|
func (c *Context) BindBuffer(target int, buffer *js.Object) {
c.Call("bindBuffer", target, buffer)
}
|
go
|
func (c *Context) BindBuffer(target int, buffer *js.Object) {
c.Call("bindBuffer", target, buffer)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BindBuffer",
"(",
"target",
"int",
",",
"buffer",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"buffer",
")",
"\n",
"}"
] |
// Associates a buffer with a buffer target.
|
[
"Associates",
"a",
"buffer",
"with",
"a",
"buffer",
"target",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L403-L405
|
3,802 |
gopherjs/webgl
|
webgl.go
|
BindFramebuffer
|
func (c *Context) BindFramebuffer(target int, framebuffer *js.Object) {
c.Call("bindFramebuffer", target, framebuffer)
}
|
go
|
func (c *Context) BindFramebuffer(target int, framebuffer *js.Object) {
c.Call("bindFramebuffer", target, framebuffer)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BindFramebuffer",
"(",
"target",
"int",
",",
"framebuffer",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"framebuffer",
")",
"\n",
"}"
] |
// Associates a WebGLFramebuffer object with the FRAMEBUFFER bind target.
|
[
"Associates",
"a",
"WebGLFramebuffer",
"object",
"with",
"the",
"FRAMEBUFFER",
"bind",
"target",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L408-L410
|
3,803 |
gopherjs/webgl
|
webgl.go
|
BindRenderbuffer
|
func (c *Context) BindRenderbuffer(target int, renderbuffer *js.Object) {
c.Call("bindRenderbuffer", target, renderbuffer)
}
|
go
|
func (c *Context) BindRenderbuffer(target int, renderbuffer *js.Object) {
c.Call("bindRenderbuffer", target, renderbuffer)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BindRenderbuffer",
"(",
"target",
"int",
",",
"renderbuffer",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"renderbuffer",
")",
"\n",
"}"
] |
// Binds a WebGLRenderbuffer object to be used for rendering.
|
[
"Binds",
"a",
"WebGLRenderbuffer",
"object",
"to",
"be",
"used",
"for",
"rendering",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L413-L415
|
3,804 |
gopherjs/webgl
|
webgl.go
|
BindTexture
|
func (c *Context) BindTexture(target int, texture *js.Object) {
c.Call("bindTexture", target, texture)
}
|
go
|
func (c *Context) BindTexture(target int, texture *js.Object) {
c.Call("bindTexture", target, texture)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BindTexture",
"(",
"target",
"int",
",",
"texture",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"texture",
")",
"\n",
"}"
] |
// Binds a named texture object to a target.
|
[
"Binds",
"a",
"named",
"texture",
"object",
"to",
"a",
"target",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L418-L420
|
3,805 |
gopherjs/webgl
|
webgl.go
|
BlendColor
|
func (c *Context) BlendColor(r, g, b, a float64) {
c.Call("blendColor", r, g, b, a)
}
|
go
|
func (c *Context) BlendColor(r, g, b, a float64) {
c.Call("blendColor", r, g, b, a)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BlendColor",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"float64",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
"\n",
"}"
] |
// The GL_BLEND_COLOR may be used to calculate the source and destination blending factors.
|
[
"The",
"GL_BLEND_COLOR",
"may",
"be",
"used",
"to",
"calculate",
"the",
"source",
"and",
"destination",
"blending",
"factors",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L423-L425
|
3,806 |
gopherjs/webgl
|
webgl.go
|
BlendEquationSeparate
|
func (c *Context) BlendEquationSeparate(modeRGB, modeAlpha int) {
c.Call("blendEquationSeparate", modeRGB, modeAlpha)
}
|
go
|
func (c *Context) BlendEquationSeparate(modeRGB, modeAlpha int) {
c.Call("blendEquationSeparate", modeRGB, modeAlpha)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BlendEquationSeparate",
"(",
"modeRGB",
",",
"modeAlpha",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"modeRGB",
",",
"modeAlpha",
")",
"\n",
"}"
] |
// Controls the blending of an incoming source fragment's R, G, B, and A values
// with a destination R, G, B, and A values as stored in the fragment's WebGLFramebuffer.
|
[
"Controls",
"the",
"blending",
"of",
"an",
"incoming",
"source",
"fragment",
"s",
"R",
"G",
"B",
"and",
"A",
"values",
"with",
"a",
"destination",
"R",
"G",
"B",
"and",
"A",
"values",
"as",
"stored",
"in",
"the",
"fragment",
"s",
"WebGLFramebuffer",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L435-L437
|
3,807 |
gopherjs/webgl
|
webgl.go
|
BlendFunc
|
func (c *Context) BlendFunc(sfactor, dfactor int) {
c.Call("blendFunc", sfactor, dfactor)
}
|
go
|
func (c *Context) BlendFunc(sfactor, dfactor int) {
c.Call("blendFunc", sfactor, dfactor)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BlendFunc",
"(",
"sfactor",
",",
"dfactor",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"sfactor",
",",
"dfactor",
")",
"\n",
"}"
] |
// Sets the blending factors used to combine source and destination pixels.
|
[
"Sets",
"the",
"blending",
"factors",
"used",
"to",
"combine",
"source",
"and",
"destination",
"pixels",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L440-L442
|
3,808 |
gopherjs/webgl
|
webgl.go
|
BlendFuncSeparate
|
func (c *Context) BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha int) {
c.Call("blendFuncSeparate", srcRGB, dstRGB, srcAlpha, dstAlpha)
}
|
go
|
func (c *Context) BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha int) {
c.Call("blendFuncSeparate", srcRGB, dstRGB, srcAlpha, dstAlpha)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BlendFuncSeparate",
"(",
"srcRGB",
",",
"dstRGB",
",",
"srcAlpha",
",",
"dstAlpha",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"srcRGB",
",",
"dstRGB",
",",
"srcAlpha",
",",
"dstAlpha",
")",
"\n",
"}"
] |
// Sets the weighting factors that are used by blendEquationSeparate.
|
[
"Sets",
"the",
"weighting",
"factors",
"that",
"are",
"used",
"by",
"blendEquationSeparate",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L445-L447
|
3,809 |
gopherjs/webgl
|
webgl.go
|
BufferData
|
func (c *Context) BufferData(target int, data interface{}, usage int) {
c.Call("bufferData", target, data, usage)
}
|
go
|
func (c *Context) BufferData(target int, data interface{}, usage int) {
c.Call("bufferData", target, data, usage)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BufferData",
"(",
"target",
"int",
",",
"data",
"interface",
"{",
"}",
",",
"usage",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"data",
",",
"usage",
")",
"\n",
"}"
] |
// Creates a buffer in memory and initializes it with array data.
// If no array is provided, the contents of the buffer is initialized to 0.
|
[
"Creates",
"a",
"buffer",
"in",
"memory",
"and",
"initializes",
"it",
"with",
"array",
"data",
".",
"If",
"no",
"array",
"is",
"provided",
"the",
"contents",
"of",
"the",
"buffer",
"is",
"initialized",
"to",
"0",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L451-L453
|
3,810 |
gopherjs/webgl
|
webgl.go
|
BufferSubData
|
func (c *Context) BufferSubData(target int, offset int, data interface{}) {
c.Call("bufferSubData", target, offset, data)
}
|
go
|
func (c *Context) BufferSubData(target int, offset int, data interface{}) {
c.Call("bufferSubData", target, offset, data)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"BufferSubData",
"(",
"target",
"int",
",",
"offset",
"int",
",",
"data",
"interface",
"{",
"}",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"offset",
",",
"data",
")",
"\n",
"}"
] |
// Used to modify or update some or all of a data store for a bound buffer object.
|
[
"Used",
"to",
"modify",
"or",
"update",
"some",
"or",
"all",
"of",
"a",
"data",
"store",
"for",
"a",
"bound",
"buffer",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L456-L458
|
3,811 |
gopherjs/webgl
|
webgl.go
|
CheckFramebufferStatus
|
func (c *Context) CheckFramebufferStatus(target int) int {
return c.Call("checkFramebufferStatus", target).Int()
}
|
go
|
func (c *Context) CheckFramebufferStatus(target int) int {
return c.Call("checkFramebufferStatus", target).Int()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"CheckFramebufferStatus",
"(",
"target",
"int",
")",
"int",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
")",
".",
"Int",
"(",
")",
"\n",
"}"
] |
// Returns whether the currently bound WebGLFramebuffer is complete.
// If not complete, returns the reason why.
|
[
"Returns",
"whether",
"the",
"currently",
"bound",
"WebGLFramebuffer",
"is",
"complete",
".",
"If",
"not",
"complete",
"returns",
"the",
"reason",
"why",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L462-L464
|
3,812 |
gopherjs/webgl
|
webgl.go
|
ClearColor
|
func (c *Context) ClearColor(r, g, b, a float32) {
c.Call("clearColor", r, g, b, a)
}
|
go
|
func (c *Context) ClearColor(r, g, b, a float32) {
c.Call("clearColor", r, g, b, a)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"ClearColor",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"float32",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
"\n",
"}"
] |
// Specifies color values to use by the clear method to clear the color buffer.
|
[
"Specifies",
"color",
"values",
"to",
"use",
"by",
"the",
"clear",
"method",
"to",
"clear",
"the",
"color",
"buffer",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L472-L474
|
3,813 |
gopherjs/webgl
|
webgl.go
|
ColorMask
|
func (c *Context) ColorMask(r, g, b, a bool) {
c.Call("colorMask", r, g, b, a)
}
|
go
|
func (c *Context) ColorMask(r, g, b, a bool) {
c.Call("colorMask", r, g, b, a)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"ColorMask",
"(",
"r",
",",
"g",
",",
"b",
",",
"a",
"bool",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
"\n",
"}"
] |
// Lets you set whether individual colors can be written when
// drawing or rendering to a framebuffer.
|
[
"Lets",
"you",
"set",
"whether",
"individual",
"colors",
"can",
"be",
"written",
"when",
"drawing",
"or",
"rendering",
"to",
"a",
"framebuffer",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L487-L489
|
3,814 |
gopherjs/webgl
|
webgl.go
|
CopyTexImage2D
|
func (c *Context) CopyTexImage2D(target, level, internal, x, y, w, h, border int) {
c.Call("copyTexImage2D", target, level, internal, x, y, w, h, border)
}
|
go
|
func (c *Context) CopyTexImage2D(target, level, internal, x, y, w, h, border int) {
c.Call("copyTexImage2D", target, level, internal, x, y, w, h, border)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"CopyTexImage2D",
"(",
"target",
",",
"level",
",",
"internal",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"border",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"level",
",",
"internal",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
",",
"border",
")",
"\n",
"}"
] |
// Copies a rectangle of pixels from the current WebGLFramebuffer into a texture image.
|
[
"Copies",
"a",
"rectangle",
"of",
"pixels",
"from",
"the",
"current",
"WebGLFramebuffer",
"into",
"a",
"texture",
"image",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L497-L499
|
3,815 |
gopherjs/webgl
|
webgl.go
|
CopyTexSubImage2D
|
func (c *Context) CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, w, h int) {
c.Call("copyTexSubImage2D", target, level, xoffset, yoffset, x, y, w, h)
}
|
go
|
func (c *Context) CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, w, h int) {
c.Call("copyTexSubImage2D", target, level, xoffset, yoffset, x, y, w, h)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"CopyTexSubImage2D",
"(",
"target",
",",
"level",
",",
"xoffset",
",",
"yoffset",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"level",
",",
"xoffset",
",",
"yoffset",
",",
"x",
",",
"y",
",",
"w",
",",
"h",
")",
"\n",
"}"
] |
// Replaces a portion of an existing 2D texture image with data from the current framebuffer.
|
[
"Replaces",
"a",
"portion",
"of",
"an",
"existing",
"2D",
"texture",
"image",
"with",
"data",
"from",
"the",
"current",
"framebuffer",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L502-L504
|
3,816 |
gopherjs/webgl
|
webgl.go
|
CreateShader
|
func (c *Context) CreateShader(typ int) *js.Object {
return c.Call("createShader", typ)
}
|
go
|
func (c *Context) CreateShader(typ int) *js.Object {
return c.Call("createShader", typ)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"CreateShader",
"(",
"typ",
"int",
")",
"*",
"js",
".",
"Object",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"typ",
")",
"\n",
"}"
] |
// Returns an empty vertex or fragment shader object based on the type specified.
|
[
"Returns",
"an",
"empty",
"vertex",
"or",
"fragment",
"shader",
"object",
"based",
"on",
"the",
"type",
"specified",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L528-L530
|
3,817 |
gopherjs/webgl
|
webgl.go
|
DepthRange
|
func (c *Context) DepthRange(zNear, zFar float64) {
c.Call("depthRange", zNear, zFar)
}
|
go
|
func (c *Context) DepthRange(zNear, zFar float64) {
c.Call("depthRange", zNear, zFar)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"DepthRange",
"(",
"zNear",
",",
"zFar",
"float64",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"zNear",
",",
"zFar",
")",
"\n",
"}"
] |
// Sets the depth range for normalized coordinates to canvas or viewport depth coordinates.
|
[
"Sets",
"the",
"depth",
"range",
"for",
"normalized",
"coordinates",
"to",
"canvas",
"or",
"viewport",
"depth",
"coordinates",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L591-L593
|
3,818 |
gopherjs/webgl
|
webgl.go
|
DetachShader
|
func (c *Context) DetachShader(program, shader *js.Object) {
c.Call("detachShader", program, shader)
}
|
go
|
func (c *Context) DetachShader(program, shader *js.Object) {
c.Call("detachShader", program, shader)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"DetachShader",
"(",
"program",
",",
"shader",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"shader",
")",
"\n",
"}"
] |
// Detach a shader object from a program object.
|
[
"Detach",
"a",
"shader",
"object",
"from",
"a",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L596-L598
|
3,819 |
gopherjs/webgl
|
webgl.go
|
DrawArrays
|
func (c *Context) DrawArrays(mode, first, count int) {
c.Call("drawArrays", mode, first, count)
}
|
go
|
func (c *Context) DrawArrays(mode, first, count int) {
c.Call("drawArrays", mode, first, count)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"DrawArrays",
"(",
"mode",
",",
"first",
",",
"count",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"mode",
",",
"first",
",",
"count",
")",
"\n",
"}"
] |
// Render geometric primitives from bound and enabled vertex data.
|
[
"Render",
"geometric",
"primitives",
"from",
"bound",
"and",
"enabled",
"vertex",
"data",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L611-L613
|
3,820 |
gopherjs/webgl
|
webgl.go
|
DrawElements
|
func (c *Context) DrawElements(mode, count, typ, offset int) {
c.Call("drawElements", mode, count, typ, offset)
}
|
go
|
func (c *Context) DrawElements(mode, count, typ, offset int) {
c.Call("drawElements", mode, count, typ, offset)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"DrawElements",
"(",
"mode",
",",
"count",
",",
"typ",
",",
"offset",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"mode",
",",
"count",
",",
"typ",
",",
"offset",
")",
"\n",
"}"
] |
// Renders geometric primitives indexed by element array data.
|
[
"Renders",
"geometric",
"primitives",
"indexed",
"by",
"element",
"array",
"data",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L616-L618
|
3,821 |
gopherjs/webgl
|
webgl.go
|
FrameBufferRenderBuffer
|
func (c *Context) FrameBufferRenderBuffer(target, attachment, renderbufferTarget int, renderbuffer *js.Object) {
c.Call("framebufferRenderBuffer", target, attachment, renderbufferTarget, renderbuffer)
}
|
go
|
func (c *Context) FrameBufferRenderBuffer(target, attachment, renderbufferTarget int, renderbuffer *js.Object) {
c.Call("framebufferRenderBuffer", target, attachment, renderbufferTarget, renderbuffer)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"FrameBufferRenderBuffer",
"(",
"target",
",",
"attachment",
",",
"renderbufferTarget",
"int",
",",
"renderbuffer",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"attachment",
",",
"renderbufferTarget",
",",
"renderbuffer",
")",
"\n",
"}"
] |
// Attaches a WebGLRenderbuffer object as a logical buffer to the
// currently bound WebGLFramebuffer object.
|
[
"Attaches",
"a",
"WebGLRenderbuffer",
"object",
"as",
"a",
"logical",
"buffer",
"to",
"the",
"currently",
"bound",
"WebGLFramebuffer",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L641-L643
|
3,822 |
gopherjs/webgl
|
webgl.go
|
FramebufferTexture2D
|
func (c *Context) FramebufferTexture2D(target, attachment, textarget int, texture *js.Object, level int) {
c.Call("framebufferTexture2D", target, attachment, textarget, texture, level)
}
|
go
|
func (c *Context) FramebufferTexture2D(target, attachment, textarget int, texture *js.Object, level int) {
c.Call("framebufferTexture2D", target, attachment, textarget, texture, level)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"FramebufferTexture2D",
"(",
"target",
",",
"attachment",
",",
"textarget",
"int",
",",
"texture",
"*",
"js",
".",
"Object",
",",
"level",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"attachment",
",",
"textarget",
",",
"texture",
",",
"level",
")",
"\n",
"}"
] |
// Attaches a texture to a WebGLFramebuffer object.
|
[
"Attaches",
"a",
"texture",
"to",
"a",
"WebGLFramebuffer",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L646-L648
|
3,823 |
gopherjs/webgl
|
webgl.go
|
GetActiveAttrib
|
func (c *Context) GetActiveAttrib(program *js.Object, index int) *js.Object {
return c.Call("getActiveAttrib", program, index)
}
|
go
|
func (c *Context) GetActiveAttrib(program *js.Object, index int) *js.Object {
return c.Call("getActiveAttrib", program, index)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetActiveAttrib",
"(",
"program",
"*",
"js",
".",
"Object",
",",
"index",
"int",
")",
"*",
"js",
".",
"Object",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"index",
")",
"\n",
"}"
] |
// Returns an WebGLActiveInfo object containing the size, type, and name
// of a vertex attribute at a specific index position in a program object.
|
[
"Returns",
"an",
"WebGLActiveInfo",
"object",
"containing",
"the",
"size",
"type",
"and",
"name",
"of",
"a",
"vertex",
"attribute",
"at",
"a",
"specific",
"index",
"position",
"in",
"a",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L664-L666
|
3,824 |
gopherjs/webgl
|
webgl.go
|
GetAttachedShaders
|
func (c *Context) GetAttachedShaders(program *js.Object) []*js.Object {
objs := c.Call("getAttachedShaders", program)
shaders := make([]*js.Object, objs.Length())
for i := 0; i < objs.Length(); i++ {
shaders[i] = objs.Index(i)
}
return shaders
}
|
go
|
func (c *Context) GetAttachedShaders(program *js.Object) []*js.Object {
objs := c.Call("getAttachedShaders", program)
shaders := make([]*js.Object, objs.Length())
for i := 0; i < objs.Length(); i++ {
shaders[i] = objs.Index(i)
}
return shaders
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetAttachedShaders",
"(",
"program",
"*",
"js",
".",
"Object",
")",
"[",
"]",
"*",
"js",
".",
"Object",
"{",
"objs",
":=",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
")",
"\n",
"shaders",
":=",
"make",
"(",
"[",
"]",
"*",
"js",
".",
"Object",
",",
"objs",
".",
"Length",
"(",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"objs",
".",
"Length",
"(",
")",
";",
"i",
"++",
"{",
"shaders",
"[",
"i",
"]",
"=",
"objs",
".",
"Index",
"(",
"i",
")",
"\n",
"}",
"\n",
"return",
"shaders",
"\n",
"}"
] |
// Returns a slice of WebGLShaders bound to a WebGLProgram.
|
[
"Returns",
"a",
"slice",
"of",
"WebGLShaders",
"bound",
"to",
"a",
"WebGLProgram",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L675-L682
|
3,825 |
gopherjs/webgl
|
webgl.go
|
GetAttribLocation
|
func (c *Context) GetAttribLocation(program *js.Object, name string) int {
return c.Call("getAttribLocation", program, name).Int()
}
|
go
|
func (c *Context) GetAttribLocation(program *js.Object, name string) int {
return c.Call("getAttribLocation", program, name).Int()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetAttribLocation",
"(",
"program",
"*",
"js",
".",
"Object",
",",
"name",
"string",
")",
"int",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"name",
")",
".",
"Int",
"(",
")",
"\n",
"}"
] |
// Returns an index to the location in a program of a named attribute variable.
|
[
"Returns",
"an",
"index",
"to",
"the",
"location",
"in",
"a",
"program",
"of",
"a",
"named",
"attribute",
"variable",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L685-L687
|
3,826 |
gopherjs/webgl
|
webgl.go
|
GetProgramParameteri
|
func (c *Context) GetProgramParameteri(program *js.Object, pname int) int {
return c.Call("getProgramParameter", program, pname).Int()
}
|
go
|
func (c *Context) GetProgramParameteri(program *js.Object, pname int) int {
return c.Call("getProgramParameter", program, pname).Int()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetProgramParameteri",
"(",
"program",
"*",
"js",
".",
"Object",
",",
"pname",
"int",
")",
"int",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"pname",
")",
".",
"Int",
"(",
")",
"\n",
"}"
] |
// Returns the value of the program parameter that corresponds to a supplied pname
// which is interpreted as an int.
|
[
"Returns",
"the",
"value",
"of",
"the",
"program",
"parameter",
"that",
"corresponds",
"to",
"a",
"supplied",
"pname",
"which",
"is",
"interpreted",
"as",
"an",
"int",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L720-L722
|
3,827 |
gopherjs/webgl
|
webgl.go
|
GetProgramParameterb
|
func (c *Context) GetProgramParameterb(program *js.Object, pname int) bool {
return c.Call("getProgramParameter", program, pname).Bool()
}
|
go
|
func (c *Context) GetProgramParameterb(program *js.Object, pname int) bool {
return c.Call("getProgramParameter", program, pname).Bool()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetProgramParameterb",
"(",
"program",
"*",
"js",
".",
"Object",
",",
"pname",
"int",
")",
"bool",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"pname",
")",
".",
"Bool",
"(",
")",
"\n",
"}"
] |
// Returns the value of the program parameter that corresponds to a supplied pname
// which is interpreted as a bool.
|
[
"Returns",
"the",
"value",
"of",
"the",
"program",
"parameter",
"that",
"corresponds",
"to",
"a",
"supplied",
"pname",
"which",
"is",
"interpreted",
"as",
"a",
"bool",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L726-L728
|
3,828 |
gopherjs/webgl
|
webgl.go
|
GetProgramInfoLog
|
func (c *Context) GetProgramInfoLog(program *js.Object) string {
return c.Call("getProgramInfoLog", program).String()
}
|
go
|
func (c *Context) GetProgramInfoLog(program *js.Object) string {
return c.Call("getProgramInfoLog", program).String()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetProgramInfoLog",
"(",
"program",
"*",
"js",
".",
"Object",
")",
"string",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
")",
".",
"String",
"(",
")",
"\n",
"}"
] |
// Returns information about the last error that occurred during
// the failed linking or validation of a WebGL program object.
|
[
"Returns",
"information",
"about",
"the",
"last",
"error",
"that",
"occurred",
"during",
"the",
"failed",
"linking",
"or",
"validation",
"of",
"a",
"WebGL",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L732-L734
|
3,829 |
gopherjs/webgl
|
webgl.go
|
GetShaderParameterb
|
func (c *Context) GetShaderParameterb(shader *js.Object, pname int) bool {
return c.Call("getShaderParameter", shader, pname).Bool()
}
|
go
|
func (c *Context) GetShaderParameterb(shader *js.Object, pname int) bool {
return c.Call("getShaderParameter", shader, pname).Bool()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetShaderParameterb",
"(",
"shader",
"*",
"js",
".",
"Object",
",",
"pname",
"int",
")",
"bool",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"shader",
",",
"pname",
")",
".",
"Bool",
"(",
")",
"\n",
"}"
] |
// Returns the value of the parameter associated with pname for a shader object.
|
[
"Returns",
"the",
"value",
"of",
"the",
"parameter",
"associated",
"with",
"pname",
"for",
"a",
"shader",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L749-L751
|
3,830 |
gopherjs/webgl
|
webgl.go
|
GetShaderInfoLog
|
func (c *Context) GetShaderInfoLog(shader *js.Object) string {
return c.Call("getShaderInfoLog", shader).String()
}
|
go
|
func (c *Context) GetShaderInfoLog(shader *js.Object) string {
return c.Call("getShaderInfoLog", shader).String()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetShaderInfoLog",
"(",
"shader",
"*",
"js",
".",
"Object",
")",
"string",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"shader",
")",
".",
"String",
"(",
")",
"\n",
"}"
] |
// Returns errors which occur when compiling a shader.
|
[
"Returns",
"errors",
"which",
"occur",
"when",
"compiling",
"a",
"shader",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L754-L756
|
3,831 |
gopherjs/webgl
|
webgl.go
|
GetSupportedExtensions
|
func (c *Context) GetSupportedExtensions() []string {
ext := c.Call("getSupportedExtensions")
extensions := make([]string, ext.Length())
for i := 0; i < ext.Length(); i++ {
extensions[i] = ext.Index(i).String()
}
return extensions
}
|
go
|
func (c *Context) GetSupportedExtensions() []string {
ext := c.Call("getSupportedExtensions")
extensions := make([]string, ext.Length())
for i := 0; i < ext.Length(); i++ {
extensions[i] = ext.Index(i).String()
}
return extensions
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetSupportedExtensions",
"(",
")",
"[",
"]",
"string",
"{",
"ext",
":=",
"c",
".",
"Call",
"(",
"\"",
"\"",
")",
"\n",
"extensions",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"ext",
".",
"Length",
"(",
")",
")",
"\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"ext",
".",
"Length",
"(",
")",
";",
"i",
"++",
"{",
"extensions",
"[",
"i",
"]",
"=",
"ext",
".",
"Index",
"(",
"i",
")",
".",
"String",
"(",
")",
"\n",
"}",
"\n",
"return",
"extensions",
"\n",
"}"
] |
// Returns a slice of supported extension strings.
|
[
"Returns",
"a",
"slice",
"of",
"supported",
"extension",
"strings",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L764-L771
|
3,832 |
gopherjs/webgl
|
webgl.go
|
GetUniformLocation
|
func (c *Context) GetUniformLocation(program *js.Object, name string) *js.Object {
return c.Call("getUniformLocation", program, name)
}
|
go
|
func (c *Context) GetUniformLocation(program *js.Object, name string) *js.Object {
return c.Call("getUniformLocation", program, name)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetUniformLocation",
"(",
"program",
"*",
"js",
".",
"Object",
",",
"name",
"string",
")",
"*",
"js",
".",
"Object",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
",",
"name",
")",
"\n",
"}"
] |
// Returns a WebGLUniformLocation object for the location
// of a uniform variable within a WebGLProgram object.
|
[
"Returns",
"a",
"WebGLUniformLocation",
"object",
"for",
"the",
"location",
"of",
"a",
"uniform",
"variable",
"within",
"a",
"WebGLProgram",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L787-L789
|
3,833 |
gopherjs/webgl
|
webgl.go
|
GetVertexAttribOffset
|
func (c *Context) GetVertexAttribOffset(index, pname int) int {
return c.Call("getVertexAttribOffset", index, pname).Int()
}
|
go
|
func (c *Context) GetVertexAttribOffset(index, pname int) int {
return c.Call("getVertexAttribOffset", index, pname).Int()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"GetVertexAttribOffset",
"(",
"index",
",",
"pname",
"int",
")",
"int",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"index",
",",
"pname",
")",
".",
"Int",
"(",
")",
"\n",
"}"
] |
// Returns the address of a specified vertex attribute.
|
[
"Returns",
"the",
"address",
"of",
"a",
"specified",
"vertex",
"attribute",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L799-L801
|
3,834 |
gopherjs/webgl
|
webgl.go
|
IsProgram
|
func (c *Context) IsProgram(program *js.Object) bool {
return c.Call("isProgram", program).Bool()
}
|
go
|
func (c *Context) IsProgram(program *js.Object) bool {
return c.Call("isProgram", program).Bool()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"IsProgram",
"(",
"program",
"*",
"js",
".",
"Object",
")",
"bool",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"program",
")",
".",
"Bool",
"(",
")",
"\n",
"}"
] |
// Returns true if program object is valid, false otherwise.
|
[
"Returns",
"true",
"if",
"program",
"object",
"is",
"valid",
"false",
"otherwise",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L821-L823
|
3,835 |
gopherjs/webgl
|
webgl.go
|
IsShader
|
func (c *Context) IsShader(shader *js.Object) bool {
return c.Call("isShader", shader).Bool()
}
|
go
|
func (c *Context) IsShader(shader *js.Object) bool {
return c.Call("isShader", shader).Bool()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"IsShader",
"(",
"shader",
"*",
"js",
".",
"Object",
")",
"bool",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"shader",
")",
".",
"Bool",
"(",
")",
"\n",
"}"
] |
// Returns true if shader is valid, false otherwise.
|
[
"Returns",
"true",
"if",
"shader",
"is",
"valid",
"false",
"otherwise",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L831-L833
|
3,836 |
gopherjs/webgl
|
webgl.go
|
IsTexture
|
func (c *Context) IsTexture(texture *js.Object) bool {
return c.Call("isTexture", texture).Bool()
}
|
go
|
func (c *Context) IsTexture(texture *js.Object) bool {
return c.Call("isTexture", texture).Bool()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"IsTexture",
"(",
"texture",
"*",
"js",
".",
"Object",
")",
"bool",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"texture",
")",
".",
"Bool",
"(",
")",
"\n",
"}"
] |
// Returns true if texture is valid, false otherwise.
|
[
"Returns",
"true",
"if",
"texture",
"is",
"valid",
"false",
"otherwise",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L836-L838
|
3,837 |
gopherjs/webgl
|
webgl.go
|
IsEnabled
|
func (c *Context) IsEnabled(capability int) bool {
return c.Call("isEnabled", capability).Bool()
}
|
go
|
func (c *Context) IsEnabled(capability int) bool {
return c.Call("isEnabled", capability).Bool()
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"IsEnabled",
"(",
"capability",
"int",
")",
"bool",
"{",
"return",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"capability",
")",
".",
"Bool",
"(",
")",
"\n",
"}"
] |
// Returns whether or not a WebGL capability is enabled for this context.
|
[
"Returns",
"whether",
"or",
"not",
"a",
"WebGL",
"capability",
"is",
"enabled",
"for",
"this",
"context",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L841-L843
|
3,838 |
gopherjs/webgl
|
webgl.go
|
PixelStorei
|
func (c *Context) PixelStorei(pname, param int) {
c.Call("pixelStorei", pname, param)
}
|
go
|
func (c *Context) PixelStorei(pname, param int) {
c.Call("pixelStorei", pname, param)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"PixelStorei",
"(",
"pname",
",",
"param",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"pname",
",",
"param",
")",
"\n",
"}"
] |
// Sets pixel storage modes for readPixels and unpacking of textures
// with texImage2D and texSubImage2D.
|
[
"Sets",
"pixel",
"storage",
"modes",
"for",
"readPixels",
"and",
"unpacking",
"of",
"textures",
"with",
"texImage2D",
"and",
"texSubImage2D",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L858-L860
|
3,839 |
gopherjs/webgl
|
webgl.go
|
PolygonOffset
|
func (c *Context) PolygonOffset(factor, units float64) {
c.Call("polygonOffset", factor, units)
}
|
go
|
func (c *Context) PolygonOffset(factor, units float64) {
c.Call("polygonOffset", factor, units)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"PolygonOffset",
"(",
"factor",
",",
"units",
"float64",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"factor",
",",
"units",
")",
"\n",
"}"
] |
// Sets the implementation-specific units and scale factor
// used to calculate fragment depth values.
|
[
"Sets",
"the",
"implementation",
"-",
"specific",
"units",
"and",
"scale",
"factor",
"used",
"to",
"calculate",
"fragment",
"depth",
"values",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L864-L866
|
3,840 |
gopherjs/webgl
|
webgl.go
|
RenderbufferStorage
|
func (c *Context) RenderbufferStorage(target, internalFormat, width, height int) {
c.Call("renderbufferStorage", target, internalFormat, width, height)
}
|
go
|
func (c *Context) RenderbufferStorage(target, internalFormat, width, height int) {
c.Call("renderbufferStorage", target, internalFormat, width, height)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"RenderbufferStorage",
"(",
"target",
",",
"internalFormat",
",",
"width",
",",
"height",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"internalFormat",
",",
"width",
",",
"height",
")",
"\n",
"}"
] |
// Creates or replaces the data store for the currently bound WebGLRenderbuffer object.
|
[
"Creates",
"or",
"replaces",
"the",
"data",
"store",
"for",
"the",
"currently",
"bound",
"WebGLRenderbuffer",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L876-L878
|
3,841 |
gopherjs/webgl
|
webgl.go
|
ShaderSource
|
func (c *Context) ShaderSource(shader *js.Object, source string) {
c.Call("shaderSource", shader, source)
}
|
go
|
func (c *Context) ShaderSource(shader *js.Object, source string) {
c.Call("shaderSource", shader, source)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"ShaderSource",
"(",
"shader",
"*",
"js",
".",
"Object",
",",
"source",
"string",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"shader",
",",
"source",
")",
"\n",
"}"
] |
// Sets and replaces shader source code in a shader object.
|
[
"Sets",
"and",
"replaces",
"shader",
"source",
"code",
"in",
"a",
"shader",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L890-L892
|
3,842 |
gopherjs/webgl
|
webgl.go
|
TexParameteri
|
func (c *Context) TexParameteri(target int, pname int, param int) {
c.Call("texParameteri", target, pname, param)
}
|
go
|
func (c *Context) TexParameteri(target int, pname int, param int) {
c.Call("texParameteri", target, pname, param)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"TexParameteri",
"(",
"target",
"int",
",",
"pname",
"int",
",",
"param",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"pname",
",",
"param",
")",
"\n",
"}"
] |
// Sets texture parameters for the current texture unit.
|
[
"Sets",
"texture",
"parameters",
"for",
"the",
"current",
"texture",
"unit",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L907-L909
|
3,843 |
gopherjs/webgl
|
webgl.go
|
TexSubImage2D
|
func (c *Context) TexSubImage2D(target, level, xoffset, yoffset, format, typ int, image *js.Object) {
c.Call("texSubImage2D", target, level, xoffset, yoffset, format, typ, image)
}
|
go
|
func (c *Context) TexSubImage2D(target, level, xoffset, yoffset, format, typ int, image *js.Object) {
c.Call("texSubImage2D", target, level, xoffset, yoffset, format, typ, image)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"TexSubImage2D",
"(",
"target",
",",
"level",
",",
"xoffset",
",",
"yoffset",
",",
"format",
",",
"typ",
"int",
",",
"image",
"*",
"js",
".",
"Object",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"target",
",",
"level",
",",
"xoffset",
",",
"yoffset",
",",
"format",
",",
"typ",
",",
"image",
")",
"\n",
"}"
] |
// Replaces a portion of an existing 2D texture image with all of another image.
|
[
"Replaces",
"a",
"portion",
"of",
"an",
"existing",
"2D",
"texture",
"image",
"with",
"all",
"of",
"another",
"image",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L912-L914
|
3,844 |
gopherjs/webgl
|
webgl.go
|
Uniform1f
|
func (c *Context) Uniform1f(location *js.Object, x float32) {
c.Call("uniform1f", location, x)
}
|
go
|
func (c *Context) Uniform1f(location *js.Object, x float32) {
c.Call("uniform1f", location, x)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform1f",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
"float32",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
")",
"\n",
"}"
] |
// Assigns a floating point value to a uniform variable for the current program object.
|
[
"Assigns",
"a",
"floating",
"point",
"value",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L917-L919
|
3,845 |
gopherjs/webgl
|
webgl.go
|
Uniform1i
|
func (c *Context) Uniform1i(location *js.Object, x int) {
c.Call("uniform1i", location, x)
}
|
go
|
func (c *Context) Uniform1i(location *js.Object, x int) {
c.Call("uniform1i", location, x)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform1i",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
")",
"\n",
"}"
] |
// Assigns a integer value to a uniform variable for the current program object.
|
[
"Assigns",
"a",
"integer",
"value",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L922-L924
|
3,846 |
gopherjs/webgl
|
webgl.go
|
Uniform2f
|
func (c *Context) Uniform2f(location *js.Object, x, y float32) {
c.Call("uniform2f", location, x, y)
}
|
go
|
func (c *Context) Uniform2f(location *js.Object, x, y float32) {
c.Call("uniform2f", location, x, y)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform2f",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
",",
"y",
"float32",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
",",
"y",
")",
"\n",
"}"
] |
// Assigns 2 floating point values to a uniform variable for the current program object.
|
[
"Assigns",
"2",
"floating",
"point",
"values",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L927-L929
|
3,847 |
gopherjs/webgl
|
webgl.go
|
Uniform2i
|
func (c *Context) Uniform2i(location *js.Object, x, y int) {
c.Call("uniform2i", location, x, y)
}
|
go
|
func (c *Context) Uniform2i(location *js.Object, x, y int) {
c.Call("uniform2i", location, x, y)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform2i",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
",",
"y",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
",",
"y",
")",
"\n",
"}"
] |
// Assigns 2 integer values to a uniform variable for the current program object.
|
[
"Assigns",
"2",
"integer",
"values",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L932-L934
|
3,848 |
gopherjs/webgl
|
webgl.go
|
Uniform3f
|
func (c *Context) Uniform3f(location *js.Object, x, y, z float32) {
c.Call("uniform3f", location, x, y, z)
}
|
go
|
func (c *Context) Uniform3f(location *js.Object, x, y, z float32) {
c.Call("uniform3f", location, x, y, z)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform3f",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
",",
"y",
",",
"z",
"float32",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
",",
"y",
",",
"z",
")",
"\n",
"}"
] |
// Assigns 3 floating point values to a uniform variable for the current program object.
|
[
"Assigns",
"3",
"floating",
"point",
"values",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L937-L939
|
3,849 |
gopherjs/webgl
|
webgl.go
|
Uniform3i
|
func (c *Context) Uniform3i(location *js.Object, x, y, z int) {
c.Call("uniform3i", location, x, y, z)
}
|
go
|
func (c *Context) Uniform3i(location *js.Object, x, y, z int) {
c.Call("uniform3i", location, x, y, z)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform3i",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
",",
"y",
",",
"z",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
",",
"y",
",",
"z",
")",
"\n",
"}"
] |
// Assigns 3 integer values to a uniform variable for the current program object.
|
[
"Assigns",
"3",
"integer",
"values",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L942-L944
|
3,850 |
gopherjs/webgl
|
webgl.go
|
Uniform4f
|
func (c *Context) Uniform4f(location *js.Object, x, y, z, w float32) {
c.Call("uniform4f", location, x, y, z, w)
}
|
go
|
func (c *Context) Uniform4f(location *js.Object, x, y, z, w float32) {
c.Call("uniform4f", location, x, y, z, w)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform4f",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
",",
"y",
",",
"z",
",",
"w",
"float32",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
",",
"y",
",",
"z",
",",
"w",
")",
"\n",
"}"
] |
// Assigns 4 floating point values to a uniform variable for the current program object.
|
[
"Assigns",
"4",
"floating",
"point",
"values",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L947-L949
|
3,851 |
gopherjs/webgl
|
webgl.go
|
Uniform4i
|
func (c *Context) Uniform4i(location *js.Object, x, y, z, w int) {
c.Call("uniform4i", location, x, y, z, w)
}
|
go
|
func (c *Context) Uniform4i(location *js.Object, x, y, z, w int) {
c.Call("uniform4i", location, x, y, z, w)
}
|
[
"func",
"(",
"c",
"*",
"Context",
")",
"Uniform4i",
"(",
"location",
"*",
"js",
".",
"Object",
",",
"x",
",",
"y",
",",
"z",
",",
"w",
"int",
")",
"{",
"c",
".",
"Call",
"(",
"\"",
"\"",
",",
"location",
",",
"x",
",",
"y",
",",
"z",
",",
"w",
")",
"\n",
"}"
] |
// Assigns 4 integer values to a uniform variable for the current program object.
|
[
"Assigns",
"4",
"integer",
"values",
"to",
"a",
"uniform",
"variable",
"for",
"the",
"current",
"program",
"object",
"."
] |
39bd6d41eeb587730fcaa65adf71978fb10675bc
|
https://github.com/gopherjs/webgl/blob/39bd6d41eeb587730fcaa65adf71978fb10675bc/webgl.go#L952-L954
|
3,852 |
benbjohnson/phantomjs
|
phantomjs.go
|
Open
|
func (p *Process) Open() error {
if err := func() error {
// Generate temporary path to run script from.
path, err := ioutil.TempDir("", "phantomjs-")
if err != nil {
return err
}
p.path = path
// Write shim script.
scriptPath := filepath.Join(path, "shim.js")
if err := ioutil.WriteFile(scriptPath, []byte(shim), 0600); err != nil {
return err
}
// Start external process.
cmd := exec.Command(p.BinPath, scriptPath)
cmd.Env = []string{fmt.Sprintf("PORT=%d", p.Port)}
cmd.Stdout = p.Stdout
cmd.Stderr = p.Stderr
if err := cmd.Start(); err != nil {
return err
}
p.cmd = cmd
// Wait until process is available.
if err := p.wait(); err != nil {
return err
}
return nil
}(); err != nil {
p.Close()
return err
}
return nil
}
|
go
|
func (p *Process) Open() error {
if err := func() error {
// Generate temporary path to run script from.
path, err := ioutil.TempDir("", "phantomjs-")
if err != nil {
return err
}
p.path = path
// Write shim script.
scriptPath := filepath.Join(path, "shim.js")
if err := ioutil.WriteFile(scriptPath, []byte(shim), 0600); err != nil {
return err
}
// Start external process.
cmd := exec.Command(p.BinPath, scriptPath)
cmd.Env = []string{fmt.Sprintf("PORT=%d", p.Port)}
cmd.Stdout = p.Stdout
cmd.Stderr = p.Stderr
if err := cmd.Start(); err != nil {
return err
}
p.cmd = cmd
// Wait until process is available.
if err := p.wait(); err != nil {
return err
}
return nil
}(); err != nil {
p.Close()
return err
}
return nil
}
|
[
"func",
"(",
"p",
"*",
"Process",
")",
"Open",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"func",
"(",
")",
"error",
"{",
"// Generate temporary path to run script from.",
"path",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"p",
".",
"path",
"=",
"path",
"\n\n",
"// Write shim script.",
"scriptPath",
":=",
"filepath",
".",
"Join",
"(",
"path",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
":=",
"ioutil",
".",
"WriteFile",
"(",
"scriptPath",
",",
"[",
"]",
"byte",
"(",
"shim",
")",
",",
"0600",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"// Start external process.",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"p",
".",
"BinPath",
",",
"scriptPath",
")",
"\n",
"cmd",
".",
"Env",
"=",
"[",
"]",
"string",
"{",
"fmt",
".",
"Sprintf",
"(",
"\"",
"\"",
",",
"p",
".",
"Port",
")",
"}",
"\n",
"cmd",
".",
"Stdout",
"=",
"p",
".",
"Stdout",
"\n",
"cmd",
".",
"Stderr",
"=",
"p",
".",
"Stderr",
"\n",
"if",
"err",
":=",
"cmd",
".",
"Start",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"p",
".",
"cmd",
"=",
"cmd",
"\n\n",
"// Wait until process is available.",
"if",
"err",
":=",
"p",
".",
"wait",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"return",
"nil",
"\n\n",
"}",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"p",
".",
"Close",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
] |
// Open start the phantomjs process with the shim script.
|
[
"Open",
"start",
"the",
"phantomjs",
"process",
"with",
"the",
"shim",
"script",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L69-L106
|
3,853 |
benbjohnson/phantomjs
|
phantomjs.go
|
Close
|
func (p *Process) Close() (err error) {
// Kill process.
if p.cmd != nil {
if e := p.cmd.Process.Kill(); e != nil && err == nil {
err = e
}
p.cmd.Wait()
}
// Remove shim file.
if p.path != "" {
if e := os.RemoveAll(p.path); e != nil && err == nil {
err = e
}
}
return err
}
|
go
|
func (p *Process) Close() (err error) {
// Kill process.
if p.cmd != nil {
if e := p.cmd.Process.Kill(); e != nil && err == nil {
err = e
}
p.cmd.Wait()
}
// Remove shim file.
if p.path != "" {
if e := os.RemoveAll(p.path); e != nil && err == nil {
err = e
}
}
return err
}
|
[
"func",
"(",
"p",
"*",
"Process",
")",
"Close",
"(",
")",
"(",
"err",
"error",
")",
"{",
"// Kill process.",
"if",
"p",
".",
"cmd",
"!=",
"nil",
"{",
"if",
"e",
":=",
"p",
".",
"cmd",
".",
"Process",
".",
"Kill",
"(",
")",
";",
"e",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"p",
".",
"cmd",
".",
"Wait",
"(",
")",
"\n",
"}",
"\n\n",
"// Remove shim file.",
"if",
"p",
".",
"path",
"!=",
"\"",
"\"",
"{",
"if",
"e",
":=",
"os",
".",
"RemoveAll",
"(",
"p",
".",
"path",
")",
";",
"e",
"!=",
"nil",
"&&",
"err",
"==",
"nil",
"{",
"err",
"=",
"e",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"err",
"\n",
"}"
] |
// Close stops the process.
|
[
"Close",
"stops",
"the",
"process",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L109-L126
|
3,854 |
benbjohnson/phantomjs
|
phantomjs.go
|
wait
|
func (p *Process) wait() error {
ticker := time.NewTicker(1000 * time.Millisecond)
defer ticker.Stop()
timer := time.NewTimer(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-timer.C:
return errors.New("timeout")
case <-ticker.C:
if err := p.ping(); err == nil {
return nil
}
}
}
}
|
go
|
func (p *Process) wait() error {
ticker := time.NewTicker(1000 * time.Millisecond)
defer ticker.Stop()
timer := time.NewTimer(30 * time.Second)
defer ticker.Stop()
for {
select {
case <-timer.C:
return errors.New("timeout")
case <-ticker.C:
if err := p.ping(); err == nil {
return nil
}
}
}
}
|
[
"func",
"(",
"p",
"*",
"Process",
")",
"wait",
"(",
")",
"error",
"{",
"ticker",
":=",
"time",
".",
"NewTicker",
"(",
"1000",
"*",
"time",
".",
"Millisecond",
")",
"\n",
"defer",
"ticker",
".",
"Stop",
"(",
")",
"\n\n",
"timer",
":=",
"time",
".",
"NewTimer",
"(",
"30",
"*",
"time",
".",
"Second",
")",
"\n",
"defer",
"ticker",
".",
"Stop",
"(",
")",
"\n\n",
"for",
"{",
"select",
"{",
"case",
"<-",
"timer",
".",
"C",
":",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"case",
"<-",
"ticker",
".",
"C",
":",
"if",
"err",
":=",
"p",
".",
"ping",
"(",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"}"
] |
// wait continually checks the process until it gets a response or times out.
|
[
"wait",
"continually",
"checks",
"the",
"process",
"until",
"it",
"gets",
"a",
"response",
"or",
"times",
"out",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L134-L151
|
3,855 |
benbjohnson/phantomjs
|
phantomjs.go
|
ping
|
func (p *Process) ping() error {
// Send request.
resp, err := http.Get(p.URL() + "/ping")
if err != nil {
return err
}
resp.Body.Close()
// Verify successful status code.
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("unexpected status: %d", resp.StatusCode)
}
return nil
}
|
go
|
func (p *Process) ping() error {
// Send request.
resp, err := http.Get(p.URL() + "/ping")
if err != nil {
return err
}
resp.Body.Close()
// Verify successful status code.
if resp.StatusCode != http.StatusOK {
return fmt.Errorf("unexpected status: %d", resp.StatusCode)
}
return nil
}
|
[
"func",
"(",
"p",
"*",
"Process",
")",
"ping",
"(",
")",
"error",
"{",
"// Send request.",
"resp",
",",
"err",
":=",
"http",
".",
"Get",
"(",
"p",
".",
"URL",
"(",
")",
"+",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"resp",
".",
"Body",
".",
"Close",
"(",
")",
"\n\n",
"// Verify successful status code.",
"if",
"resp",
".",
"StatusCode",
"!=",
"http",
".",
"StatusOK",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"resp",
".",
"StatusCode",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// ping checks the process to see if it is up.
|
[
"ping",
"checks",
"the",
"process",
"to",
"see",
"if",
"it",
"is",
"up",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L154-L167
|
3,856 |
benbjohnson/phantomjs
|
phantomjs.go
|
CreateWebPage
|
func (p *Process) CreateWebPage() (*WebPage, error) {
var resp struct {
Ref refJSON `json:"ref"`
}
if err := p.doJSON("POST", "/webpage/Create", nil, &resp); err != nil {
return nil, err
}
return &WebPage{ref: newRef(p, resp.Ref.ID)}, nil
}
|
go
|
func (p *Process) CreateWebPage() (*WebPage, error) {
var resp struct {
Ref refJSON `json:"ref"`
}
if err := p.doJSON("POST", "/webpage/Create", nil, &resp); err != nil {
return nil, err
}
return &WebPage{ref: newRef(p, resp.Ref.ID)}, nil
}
|
[
"func",
"(",
"p",
"*",
"Process",
")",
"CreateWebPage",
"(",
")",
"(",
"*",
"WebPage",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Ref",
"refJSON",
"`json:\"ref\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"nil",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"&",
"WebPage",
"{",
"ref",
":",
"newRef",
"(",
"p",
",",
"resp",
".",
"Ref",
".",
"ID",
")",
"}",
",",
"nil",
"\n",
"}"
] |
// CreateWebPage returns a new instance of a "webpage".
|
[
"CreateWebPage",
"returns",
"a",
"new",
"instance",
"of",
"a",
"webpage",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L170-L178
|
3,857 |
benbjohnson/phantomjs
|
phantomjs.go
|
Open
|
func (p *WebPage) Open(url string) error {
req := map[string]interface{}{
"ref": p.ref.id,
"url": url,
}
var resp struct {
Status string `json:"status"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Open", req, &resp); err != nil {
return err
}
if resp.Status != "success" {
return errors.New("failed")
}
return nil
}
|
go
|
func (p *WebPage) Open(url string) error {
req := map[string]interface{}{
"ref": p.ref.id,
"url": url,
}
var resp struct {
Status string `json:"status"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Open", req, &resp); err != nil {
return err
}
if resp.Status != "success" {
return errors.New("failed")
}
return nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Open",
"(",
"url",
"string",
")",
"error",
"{",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"url",
",",
"}",
"\n",
"var",
"resp",
"struct",
"{",
"Status",
"string",
"`json:\"status\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"resp",
".",
"Status",
"!=",
"\"",
"\"",
"{",
"return",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
] |
// Open opens a URL.
|
[
"Open",
"opens",
"a",
"URL",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L253-L269
|
3,858 |
benbjohnson/phantomjs
|
phantomjs.go
|
ClipRect
|
func (p *WebPage) ClipRect() (Rect, error) {
var resp struct {
Value rectJSON `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/ClipRect", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return Rect{}, err
}
return Rect{
Top: resp.Value.Top,
Left: resp.Value.Left,
Width: resp.Value.Width,
Height: resp.Value.Height,
}, nil
}
|
go
|
func (p *WebPage) ClipRect() (Rect, error) {
var resp struct {
Value rectJSON `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/ClipRect", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return Rect{}, err
}
return Rect{
Top: resp.Value.Top,
Left: resp.Value.Left,
Width: resp.Value.Width,
Height: resp.Value.Height,
}, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"ClipRect",
"(",
")",
"(",
"Rect",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Value",
"rectJSON",
"`json:\"value\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"Rect",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"Rect",
"{",
"Top",
":",
"resp",
".",
"Value",
".",
"Top",
",",
"Left",
":",
"resp",
".",
"Value",
".",
"Left",
",",
"Width",
":",
"resp",
".",
"Value",
".",
"Width",
",",
"Height",
":",
"resp",
".",
"Value",
".",
"Height",
",",
"}",
",",
"nil",
"\n",
"}"
] |
// ClipRect returns the clipping rectangle used when rendering.
// Returns nil if no clipping rectangle is set.
|
[
"ClipRect",
"returns",
"the",
"clipping",
"rectangle",
"used",
"when",
"rendering",
".",
"Returns",
"nil",
"if",
"no",
"clipping",
"rectangle",
"is",
"set",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L295-L308
|
3,859 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetClipRect
|
func (p *WebPage) SetClipRect(rect Rect) error {
req := map[string]interface{}{
"ref": p.ref.id,
"rect": rectJSON{
Top: rect.Top,
Left: rect.Left,
Width: rect.Width,
Height: rect.Height,
},
}
return p.ref.process.doJSON("POST", "/webpage/SetClipRect", req, nil)
}
|
go
|
func (p *WebPage) SetClipRect(rect Rect) error {
req := map[string]interface{}{
"ref": p.ref.id,
"rect": rectJSON{
Top: rect.Top,
Left: rect.Left,
Width: rect.Width,
Height: rect.Height,
},
}
return p.ref.process.doJSON("POST", "/webpage/SetClipRect", req, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetClipRect",
"(",
"rect",
"Rect",
")",
"error",
"{",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"rectJSON",
"{",
"Top",
":",
"rect",
".",
"Top",
",",
"Left",
":",
"rect",
".",
"Left",
",",
"Width",
":",
"rect",
".",
"Width",
",",
"Height",
":",
"rect",
".",
"Height",
",",
"}",
",",
"}",
"\n",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
// SetClipRect sets the clipping rectangle used when rendering.
// Set to nil to render the entire webpage.
|
[
"SetClipRect",
"sets",
"the",
"clipping",
"rectangle",
"used",
"when",
"rendering",
".",
"Set",
"to",
"nil",
"to",
"render",
"the",
"entire",
"webpage",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L312-L323
|
3,860 |
benbjohnson/phantomjs
|
phantomjs.go
|
Cookies
|
func (p *WebPage) Cookies() ([]*http.Cookie, error) {
var resp struct {
Value []cookieJSON `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Cookies", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return nil, err
}
a := make([]*http.Cookie, len(resp.Value))
for i := range resp.Value {
a[i] = decodeCookieJSON(resp.Value[i])
}
return a, nil
}
|
go
|
func (p *WebPage) Cookies() ([]*http.Cookie, error) {
var resp struct {
Value []cookieJSON `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Cookies", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return nil, err
}
a := make([]*http.Cookie, len(resp.Value))
for i := range resp.Value {
a[i] = decodeCookieJSON(resp.Value[i])
}
return a, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Cookies",
"(",
")",
"(",
"[",
"]",
"*",
"http",
".",
"Cookie",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Value",
"[",
"]",
"cookieJSON",
"`json:\"value\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"a",
":=",
"make",
"(",
"[",
"]",
"*",
"http",
".",
"Cookie",
",",
"len",
"(",
"resp",
".",
"Value",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"resp",
".",
"Value",
"{",
"a",
"[",
"i",
"]",
"=",
"decodeCookieJSON",
"(",
"resp",
".",
"Value",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"return",
"a",
",",
"nil",
"\n",
"}"
] |
// Cookies returns a list of cookies visible to the current URL.
|
[
"Cookies",
"returns",
"a",
"list",
"of",
"cookies",
"visible",
"to",
"the",
"current",
"URL",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L342-L355
|
3,861 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetCookies
|
func (p *WebPage) SetCookies(cookies []*http.Cookie) error {
a := make([]cookieJSON, len(cookies))
for i := range cookies {
a[i] = encodeCookieJSON(cookies[i])
}
req := map[string]interface{}{"ref": p.ref.id, "cookies": a}
return p.ref.process.doJSON("POST", "/webpage/SetCookies", req, nil)
}
|
go
|
func (p *WebPage) SetCookies(cookies []*http.Cookie) error {
a := make([]cookieJSON, len(cookies))
for i := range cookies {
a[i] = encodeCookieJSON(cookies[i])
}
req := map[string]interface{}{"ref": p.ref.id, "cookies": a}
return p.ref.process.doJSON("POST", "/webpage/SetCookies", req, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetCookies",
"(",
"cookies",
"[",
"]",
"*",
"http",
".",
"Cookie",
")",
"error",
"{",
"a",
":=",
"make",
"(",
"[",
"]",
"cookieJSON",
",",
"len",
"(",
"cookies",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"cookies",
"{",
"a",
"[",
"i",
"]",
"=",
"encodeCookieJSON",
"(",
"cookies",
"[",
"i",
"]",
")",
"\n",
"}",
"\n",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"a",
"}",
"\n",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
// SetCookies sets a list of cookies visible to the current URL.
|
[
"SetCookies",
"sets",
"a",
"list",
"of",
"cookies",
"visible",
"to",
"the",
"current",
"URL",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L358-L365
|
3,862 |
benbjohnson/phantomjs
|
phantomjs.go
|
CustomHeaders
|
func (p *WebPage) CustomHeaders() (http.Header, error) {
var resp struct {
Value map[string]string `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/CustomHeaders", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return nil, err
}
// Convert to a header object.
hdr := make(http.Header)
for key, value := range resp.Value {
hdr.Set(key, value)
}
return hdr, nil
}
|
go
|
func (p *WebPage) CustomHeaders() (http.Header, error) {
var resp struct {
Value map[string]string `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/CustomHeaders", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return nil, err
}
// Convert to a header object.
hdr := make(http.Header)
for key, value := range resp.Value {
hdr.Set(key, value)
}
return hdr, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"CustomHeaders",
"(",
")",
"(",
"http",
".",
"Header",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Value",
"map",
"[",
"string",
"]",
"string",
"`json:\"value\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Convert to a header object.",
"hdr",
":=",
"make",
"(",
"http",
".",
"Header",
")",
"\n",
"for",
"key",
",",
"value",
":=",
"range",
"resp",
".",
"Value",
"{",
"hdr",
".",
"Set",
"(",
"key",
",",
"value",
")",
"\n",
"}",
"\n",
"return",
"hdr",
",",
"nil",
"\n",
"}"
] |
// CustomHeaders returns a list of additional headers sent with the web page.
|
[
"CustomHeaders",
"returns",
"a",
"list",
"of",
"additional",
"headers",
"sent",
"with",
"the",
"web",
"page",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L368-L382
|
3,863 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetCustomHeaders
|
func (p *WebPage) SetCustomHeaders(header http.Header) error {
m := make(map[string]string)
for key := range header {
m[key] = header.Get(key)
}
req := map[string]interface{}{"ref": p.ref.id, "headers": m}
return p.ref.process.doJSON("POST", "/webpage/SetCustomHeaders", req, nil)
}
|
go
|
func (p *WebPage) SetCustomHeaders(header http.Header) error {
m := make(map[string]string)
for key := range header {
m[key] = header.Get(key)
}
req := map[string]interface{}{"ref": p.ref.id, "headers": m}
return p.ref.process.doJSON("POST", "/webpage/SetCustomHeaders", req, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetCustomHeaders",
"(",
"header",
"http",
".",
"Header",
")",
"error",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
")",
"\n",
"for",
"key",
":=",
"range",
"header",
"{",
"m",
"[",
"key",
"]",
"=",
"header",
".",
"Get",
"(",
"key",
")",
"\n",
"}",
"\n",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"m",
"}",
"\n",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
// SetCustomHeaders sets a list of additional headers sent with the web page.
//
// This function does not support multiple headers with the same name. Only
// the first value for a header key will be used.
|
[
"SetCustomHeaders",
"sets",
"a",
"list",
"of",
"additional",
"headers",
"sent",
"with",
"the",
"web",
"page",
".",
"This",
"function",
"does",
"not",
"support",
"multiple",
"headers",
"with",
"the",
"same",
"name",
".",
"Only",
"the",
"first",
"value",
"for",
"a",
"header",
"key",
"will",
"be",
"used",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L388-L395
|
3,864 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetFrameContent
|
func (p *WebPage) SetFrameContent(content string) error {
return p.ref.process.doJSON("POST", "/webpage/SetFrameContent", map[string]interface{}{"ref": p.ref.id, "content": content}, nil)
}
|
go
|
func (p *WebPage) SetFrameContent(content string) error {
return p.ref.process.doJSON("POST", "/webpage/SetFrameContent", map[string]interface{}{"ref": p.ref.id, "content": content}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetFrameContent",
"(",
"content",
"string",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"content",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetFrameContent sets the content of the current frame.
|
[
"SetFrameContent",
"sets",
"the",
"content",
"of",
"the",
"current",
"frame",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L420-L422
|
3,865 |
benbjohnson/phantomjs
|
phantomjs.go
|
NavigationLocked
|
func (p *WebPage) NavigationLocked() (bool, error) {
var resp struct {
Value bool `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/NavigationLocked", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return false, err
}
return resp.Value, nil
}
|
go
|
func (p *WebPage) NavigationLocked() (bool, error) {
var resp struct {
Value bool `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/NavigationLocked", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return false, err
}
return resp.Value, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"NavigationLocked",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Value",
"bool",
"`json:\"value\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"Value",
",",
"nil",
"\n",
"}"
] |
// NavigationLocked returns true if the navigation away from the page is disabled.
|
[
"NavigationLocked",
"returns",
"true",
"if",
"the",
"navigation",
"away",
"from",
"the",
"page",
"is",
"disabled",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L508-L516
|
3,866 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetNavigationLocked
|
func (p *WebPage) SetNavigationLocked(value bool) error {
return p.ref.process.doJSON("POST", "/webpage/SetNavigationLocked", map[string]interface{}{"ref": p.ref.id, "value": value}, nil)
}
|
go
|
func (p *WebPage) SetNavigationLocked(value bool) error {
return p.ref.process.doJSON("POST", "/webpage/SetNavigationLocked", map[string]interface{}{"ref": p.ref.id, "value": value}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetNavigationLocked",
"(",
"value",
"bool",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"value",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetNavigationLocked sets whether navigation away from the page should be disabled.
|
[
"SetNavigationLocked",
"sets",
"whether",
"navigation",
"away",
"from",
"the",
"page",
"should",
"be",
"disabled",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L519-L521
|
3,867 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetOwnsPages
|
func (p *WebPage) SetOwnsPages(v bool) error {
return p.ref.process.doJSON("POST", "/webpage/SetOwnsPages", map[string]interface{}{"ref": p.ref.id, "value": v}, nil)
}
|
go
|
func (p *WebPage) SetOwnsPages(v bool) error {
return p.ref.process.doJSON("POST", "/webpage/SetOwnsPages", map[string]interface{}{"ref": p.ref.id, "value": v}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetOwnsPages",
"(",
"v",
"bool",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"v",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetOwnsPages sets whether this page owns pages opened in other windows.
|
[
"SetOwnsPages",
"sets",
"whether",
"this",
"page",
"owns",
"pages",
"opened",
"in",
"other",
"windows",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L557-L559
|
3,868 |
benbjohnson/phantomjs
|
phantomjs.go
|
Pages
|
func (p *WebPage) Pages() ([]*WebPage, error) {
var resp struct {
Refs []refJSON `json:"refs"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Pages", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return nil, err
}
// Convert reference IDs to web pages.
a := make([]*WebPage, len(resp.Refs))
for i, ref := range resp.Refs {
a[i] = &WebPage{ref: newRef(p.ref.process, ref.ID)}
}
return a, nil
}
|
go
|
func (p *WebPage) Pages() ([]*WebPage, error) {
var resp struct {
Refs []refJSON `json:"refs"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Pages", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return nil, err
}
// Convert reference IDs to web pages.
a := make([]*WebPage, len(resp.Refs))
for i, ref := range resp.Refs {
a[i] = &WebPage{ref: newRef(p.ref.process, ref.ID)}
}
return a, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Pages",
"(",
")",
"(",
"[",
"]",
"*",
"WebPage",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Refs",
"[",
"]",
"refJSON",
"`json:\"refs\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"// Convert reference IDs to web pages.",
"a",
":=",
"make",
"(",
"[",
"]",
"*",
"WebPage",
",",
"len",
"(",
"resp",
".",
"Refs",
")",
")",
"\n",
"for",
"i",
",",
"ref",
":=",
"range",
"resp",
".",
"Refs",
"{",
"a",
"[",
"i",
"]",
"=",
"&",
"WebPage",
"{",
"ref",
":",
"newRef",
"(",
"p",
".",
"ref",
".",
"process",
",",
"ref",
".",
"ID",
")",
"}",
"\n",
"}",
"\n",
"return",
"a",
",",
"nil",
"\n",
"}"
] |
// Pages returns a list of owned pages.
|
[
"Pages",
"returns",
"a",
"list",
"of",
"owned",
"pages",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L573-L587
|
3,869 |
benbjohnson/phantomjs
|
phantomjs.go
|
PaperSize
|
func (p *WebPage) PaperSize() (PaperSize, error) {
var resp struct {
Value paperSizeJSON `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/PaperSize", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return PaperSize{}, err
}
return decodePaperSizeJSON(resp.Value), nil
}
|
go
|
func (p *WebPage) PaperSize() (PaperSize, error) {
var resp struct {
Value paperSizeJSON `json:"value"`
}
if err := p.ref.process.doJSON("POST", "/webpage/PaperSize", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return PaperSize{}, err
}
return decodePaperSizeJSON(resp.Value), nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"PaperSize",
"(",
")",
"(",
"PaperSize",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Value",
"paperSizeJSON",
"`json:\"value\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"PaperSize",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"decodePaperSizeJSON",
"(",
"resp",
".",
"Value",
")",
",",
"nil",
"\n",
"}"
] |
// PaperSize returns the size of the web page when rendered as a PDF.
|
[
"PaperSize",
"returns",
"the",
"size",
"of",
"the",
"web",
"page",
"when",
"rendered",
"as",
"a",
"PDF",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L590-L598
|
3,870 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetPaperSize
|
func (p *WebPage) SetPaperSize(size PaperSize) error {
req := map[string]interface{}{"ref": p.ref.id, "size": encodePaperSizeJSON(size)}
return p.ref.process.doJSON("POST", "/webpage/SetPaperSize", req, nil)
}
|
go
|
func (p *WebPage) SetPaperSize(size PaperSize) error {
req := map[string]interface{}{"ref": p.ref.id, "size": encodePaperSizeJSON(size)}
return p.ref.process.doJSON("POST", "/webpage/SetPaperSize", req, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetPaperSize",
"(",
"size",
"PaperSize",
")",
"error",
"{",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"encodePaperSizeJSON",
"(",
"size",
")",
"}",
"\n",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
// SetPaperSize sets the size of the web page when rendered as a PDF.
|
[
"SetPaperSize",
"sets",
"the",
"size",
"of",
"the",
"web",
"page",
"when",
"rendered",
"as",
"a",
"PDF",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L601-L604
|
3,871 |
benbjohnson/phantomjs
|
phantomjs.go
|
ScrollPosition
|
func (p *WebPage) ScrollPosition() (Position, error) {
var resp struct {
Top int `json:"top"`
Left int `json:"left"`
}
if err := p.ref.process.doJSON("POST", "/webpage/ScrollPosition", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return Position{}, err
}
return Position{Top: resp.Top, Left: resp.Left}, nil
}
|
go
|
func (p *WebPage) ScrollPosition() (Position, error) {
var resp struct {
Top int `json:"top"`
Left int `json:"left"`
}
if err := p.ref.process.doJSON("POST", "/webpage/ScrollPosition", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return Position{}, err
}
return Position{Top: resp.Top, Left: resp.Left}, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"ScrollPosition",
"(",
")",
"(",
"Position",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Top",
"int",
"`json:\"top\"`",
"\n",
"Left",
"int",
"`json:\"left\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"Position",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"Position",
"{",
"Top",
":",
"resp",
".",
"Top",
",",
"Left",
":",
"resp",
".",
"Left",
"}",
",",
"nil",
"\n",
"}"
] |
// ScrollPosition returns the current scroll position of the page.
|
[
"ScrollPosition",
"returns",
"the",
"current",
"scroll",
"position",
"of",
"the",
"page",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L618-L627
|
3,872 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetScrollPosition
|
func (p *WebPage) SetScrollPosition(pos Position) error {
return p.ref.process.doJSON("POST", "/webpage/SetScrollPosition", map[string]interface{}{"ref": p.ref.id, "top": pos.Top, "left": pos.Left}, nil)
}
|
go
|
func (p *WebPage) SetScrollPosition(pos Position) error {
return p.ref.process.doJSON("POST", "/webpage/SetScrollPosition", map[string]interface{}{"ref": p.ref.id, "top": pos.Top, "left": pos.Left}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetScrollPosition",
"(",
"pos",
"Position",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"pos",
".",
"Top",
",",
"\"",
"\"",
":",
"pos",
".",
"Left",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetScrollPosition sets the current scroll position of the page.
|
[
"SetScrollPosition",
"sets",
"the",
"current",
"scroll",
"position",
"of",
"the",
"page",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L630-L632
|
3,873 |
benbjohnson/phantomjs
|
phantomjs.go
|
Settings
|
func (p *WebPage) Settings() (WebPageSettings, error) {
var resp struct {
Settings webPageSettingsJSON `json:"settings"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Settings", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return WebPageSettings{}, err
}
return WebPageSettings{
JavascriptEnabled: resp.Settings.JavascriptEnabled,
LoadImages: resp.Settings.LoadImages,
LocalToRemoteURLAccessEnabled: resp.Settings.LocalToRemoteURLAccessEnabled,
UserAgent: resp.Settings.UserAgent,
Username: resp.Settings.Username,
Password: resp.Settings.Password,
XSSAuditingEnabled: resp.Settings.XSSAuditingEnabled,
WebSecurityEnabled: resp.Settings.WebSecurityEnabled,
ResourceTimeout: time.Duration(resp.Settings.ResourceTimeout) * time.Millisecond,
}, nil
}
|
go
|
func (p *WebPage) Settings() (WebPageSettings, error) {
var resp struct {
Settings webPageSettingsJSON `json:"settings"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Settings", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return WebPageSettings{}, err
}
return WebPageSettings{
JavascriptEnabled: resp.Settings.JavascriptEnabled,
LoadImages: resp.Settings.LoadImages,
LocalToRemoteURLAccessEnabled: resp.Settings.LocalToRemoteURLAccessEnabled,
UserAgent: resp.Settings.UserAgent,
Username: resp.Settings.Username,
Password: resp.Settings.Password,
XSSAuditingEnabled: resp.Settings.XSSAuditingEnabled,
WebSecurityEnabled: resp.Settings.WebSecurityEnabled,
ResourceTimeout: time.Duration(resp.Settings.ResourceTimeout) * time.Millisecond,
}, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Settings",
"(",
")",
"(",
"WebPageSettings",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Settings",
"webPageSettingsJSON",
"`json:\"settings\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"WebPageSettings",
"{",
"}",
",",
"err",
"\n",
"}",
"\n",
"return",
"WebPageSettings",
"{",
"JavascriptEnabled",
":",
"resp",
".",
"Settings",
".",
"JavascriptEnabled",
",",
"LoadImages",
":",
"resp",
".",
"Settings",
".",
"LoadImages",
",",
"LocalToRemoteURLAccessEnabled",
":",
"resp",
".",
"Settings",
".",
"LocalToRemoteURLAccessEnabled",
",",
"UserAgent",
":",
"resp",
".",
"Settings",
".",
"UserAgent",
",",
"Username",
":",
"resp",
".",
"Settings",
".",
"Username",
",",
"Password",
":",
"resp",
".",
"Settings",
".",
"Password",
",",
"XSSAuditingEnabled",
":",
"resp",
".",
"Settings",
".",
"XSSAuditingEnabled",
",",
"WebSecurityEnabled",
":",
"resp",
".",
"Settings",
".",
"WebSecurityEnabled",
",",
"ResourceTimeout",
":",
"time",
".",
"Duration",
"(",
"resp",
".",
"Settings",
".",
"ResourceTimeout",
")",
"*",
"time",
".",
"Millisecond",
",",
"}",
",",
"nil",
"\n",
"}"
] |
// Settings returns the settings used on the web page.
|
[
"Settings",
"returns",
"the",
"settings",
"used",
"on",
"the",
"web",
"page",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L635-L653
|
3,874 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetSettings
|
func (p *WebPage) SetSettings(settings WebPageSettings) error {
req := map[string]interface{}{
"ref": p.ref.id,
"settings": webPageSettingsJSON{
JavascriptEnabled: settings.JavascriptEnabled,
LoadImages: settings.LoadImages,
LocalToRemoteURLAccessEnabled: settings.LocalToRemoteURLAccessEnabled,
UserAgent: settings.UserAgent,
Username: settings.Username,
Password: settings.Password,
XSSAuditingEnabled: settings.XSSAuditingEnabled,
WebSecurityEnabled: settings.WebSecurityEnabled,
ResourceTimeout: int(settings.ResourceTimeout / time.Millisecond),
},
}
return p.ref.process.doJSON("POST", "/webpage/SetSettings", req, nil)
}
|
go
|
func (p *WebPage) SetSettings(settings WebPageSettings) error {
req := map[string]interface{}{
"ref": p.ref.id,
"settings": webPageSettingsJSON{
JavascriptEnabled: settings.JavascriptEnabled,
LoadImages: settings.LoadImages,
LocalToRemoteURLAccessEnabled: settings.LocalToRemoteURLAccessEnabled,
UserAgent: settings.UserAgent,
Username: settings.Username,
Password: settings.Password,
XSSAuditingEnabled: settings.XSSAuditingEnabled,
WebSecurityEnabled: settings.WebSecurityEnabled,
ResourceTimeout: int(settings.ResourceTimeout / time.Millisecond),
},
}
return p.ref.process.doJSON("POST", "/webpage/SetSettings", req, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetSettings",
"(",
"settings",
"WebPageSettings",
")",
"error",
"{",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"webPageSettingsJSON",
"{",
"JavascriptEnabled",
":",
"settings",
".",
"JavascriptEnabled",
",",
"LoadImages",
":",
"settings",
".",
"LoadImages",
",",
"LocalToRemoteURLAccessEnabled",
":",
"settings",
".",
"LocalToRemoteURLAccessEnabled",
",",
"UserAgent",
":",
"settings",
".",
"UserAgent",
",",
"Username",
":",
"settings",
".",
"Username",
",",
"Password",
":",
"settings",
".",
"Password",
",",
"XSSAuditingEnabled",
":",
"settings",
".",
"XSSAuditingEnabled",
",",
"WebSecurityEnabled",
":",
"settings",
".",
"WebSecurityEnabled",
",",
"ResourceTimeout",
":",
"int",
"(",
"settings",
".",
"ResourceTimeout",
"/",
"time",
".",
"Millisecond",
")",
",",
"}",
",",
"}",
"\n",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
// SetSettings sets various settings on the web page.
//
// The settings apply only during the initial call to the page.open function.
// Subsequent modification of the settings object will not have any impact.
|
[
"SetSettings",
"sets",
"various",
"settings",
"on",
"the",
"web",
"page",
".",
"The",
"settings",
"apply",
"only",
"during",
"the",
"initial",
"call",
"to",
"the",
"page",
".",
"open",
"function",
".",
"Subsequent",
"modification",
"of",
"the",
"settings",
"object",
"will",
"not",
"have",
"any",
"impact",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L659-L675
|
3,875 |
benbjohnson/phantomjs
|
phantomjs.go
|
ViewportSize
|
func (p *WebPage) ViewportSize() (width, height int, err error) {
var resp struct {
Width int `json:"width"`
Height int `json:"height"`
}
if err := p.ref.process.doJSON("POST", "/webpage/ViewportSize", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return 0, 0, err
}
return resp.Width, resp.Height, nil
}
|
go
|
func (p *WebPage) ViewportSize() (width, height int, err error) {
var resp struct {
Width int `json:"width"`
Height int `json:"height"`
}
if err := p.ref.process.doJSON("POST", "/webpage/ViewportSize", map[string]interface{}{"ref": p.ref.id}, &resp); err != nil {
return 0, 0, err
}
return resp.Width, resp.Height, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"ViewportSize",
"(",
")",
"(",
"width",
",",
"height",
"int",
",",
"err",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Width",
"int",
"`json:\"width\"`",
"\n",
"Height",
"int",
"`json:\"height\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"0",
",",
"0",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"Width",
",",
"resp",
".",
"Height",
",",
"nil",
"\n",
"}"
] |
// ViewportSize returns the size of the viewport on the browser.
|
[
"ViewportSize",
"returns",
"the",
"size",
"of",
"the",
"viewport",
"on",
"the",
"browser",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L700-L709
|
3,876 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetViewportSize
|
func (p *WebPage) SetViewportSize(width, height int) error {
return p.ref.process.doJSON("POST", "/webpage/SetViewportSize", map[string]interface{}{"ref": p.ref.id, "width": width, "height": height}, nil)
}
|
go
|
func (p *WebPage) SetViewportSize(width, height int) error {
return p.ref.process.doJSON("POST", "/webpage/SetViewportSize", map[string]interface{}{"ref": p.ref.id, "width": width, "height": height}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetViewportSize",
"(",
"width",
",",
"height",
"int",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"width",
",",
"\"",
"\"",
":",
"height",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetViewportSize sets the size of the viewport.
|
[
"SetViewportSize",
"sets",
"the",
"size",
"of",
"the",
"viewport",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L712-L714
|
3,877 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetZoomFactor
|
func (p *WebPage) SetZoomFactor(factor float64) error {
return p.ref.process.doJSON("POST", "/webpage/SetZoomFactor", map[string]interface{}{"ref": p.ref.id, "value": factor}, nil)
}
|
go
|
func (p *WebPage) SetZoomFactor(factor float64) error {
return p.ref.process.doJSON("POST", "/webpage/SetZoomFactor", map[string]interface{}{"ref": p.ref.id, "value": factor}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetZoomFactor",
"(",
"factor",
"float64",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"factor",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetZoomFactor sets the zoom factor when rendering the page.
|
[
"SetZoomFactor",
"sets",
"the",
"zoom",
"factor",
"when",
"rendering",
"the",
"page",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L739-L741
|
3,878 |
benbjohnson/phantomjs
|
phantomjs.go
|
AddCookie
|
func (p *WebPage) AddCookie(cookie *http.Cookie) (bool, error) {
var resp struct {
ReturnValue bool `json:"returnValue"`
}
req := map[string]interface{}{"ref": p.ref.id, "cookie": encodeCookieJSON(cookie)}
if err := p.ref.process.doJSON("POST", "/webpage/AddCookie", req, &resp); err != nil {
return false, err
}
return resp.ReturnValue, nil
}
|
go
|
func (p *WebPage) AddCookie(cookie *http.Cookie) (bool, error) {
var resp struct {
ReturnValue bool `json:"returnValue"`
}
req := map[string]interface{}{"ref": p.ref.id, "cookie": encodeCookieJSON(cookie)}
if err := p.ref.process.doJSON("POST", "/webpage/AddCookie", req, &resp); err != nil {
return false, err
}
return resp.ReturnValue, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"AddCookie",
"(",
"cookie",
"*",
"http",
".",
"Cookie",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"ReturnValue",
"bool",
"`json:\"returnValue\"`",
"\n",
"}",
"\n",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"encodeCookieJSON",
"(",
"cookie",
")",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"ReturnValue",
",",
"nil",
"\n",
"}"
] |
// AddCookie adds a cookie to the page.
// Returns true if the cookie was successfully added.
|
[
"AddCookie",
"adds",
"a",
"cookie",
"to",
"the",
"page",
".",
"Returns",
"true",
"if",
"the",
"cookie",
"was",
"successfully",
"added",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L745-L754
|
3,879 |
benbjohnson/phantomjs
|
phantomjs.go
|
DeleteCookie
|
func (p *WebPage) DeleteCookie(name string) (bool, error) {
var resp struct {
ReturnValue bool `json:"returnValue"`
}
req := map[string]interface{}{"ref": p.ref.id, "name": name}
if err := p.ref.process.doJSON("POST", "/webpage/DeleteCookie", req, &resp); err != nil {
return false, err
}
return resp.ReturnValue, nil
}
|
go
|
func (p *WebPage) DeleteCookie(name string) (bool, error) {
var resp struct {
ReturnValue bool `json:"returnValue"`
}
req := map[string]interface{}{"ref": p.ref.id, "name": name}
if err := p.ref.process.doJSON("POST", "/webpage/DeleteCookie", req, &resp); err != nil {
return false, err
}
return resp.ReturnValue, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"DeleteCookie",
"(",
"name",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"ReturnValue",
"bool",
"`json:\"returnValue\"`",
"\n",
"}",
"\n",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"name",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"false",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"ReturnValue",
",",
"nil",
"\n",
"}"
] |
// DeleteCookie removes a cookie with a matching name.
// Returns true if the cookie was successfully deleted.
|
[
"DeleteCookie",
"removes",
"a",
"cookie",
"with",
"a",
"matching",
"name",
".",
"Returns",
"true",
"if",
"the",
"cookie",
"was",
"successfully",
"deleted",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L768-L777
|
3,880 |
benbjohnson/phantomjs
|
phantomjs.go
|
EvaluateAsync
|
func (p *WebPage) EvaluateAsync(script string, delay time.Duration) error {
return p.ref.process.doJSON("POST", "/webpage/EvaluateAsync", map[string]interface{}{"ref": p.ref.id, "script": script, "delay": int(delay / time.Millisecond)}, nil)
}
|
go
|
func (p *WebPage) EvaluateAsync(script string, delay time.Duration) error {
return p.ref.process.doJSON("POST", "/webpage/EvaluateAsync", map[string]interface{}{"ref": p.ref.id, "script": script, "delay": int(delay / time.Millisecond)}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"EvaluateAsync",
"(",
"script",
"string",
",",
"delay",
"time",
".",
"Duration",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"script",
",",
"\"",
"\"",
":",
"int",
"(",
"delay",
"/",
"time",
".",
"Millisecond",
")",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// EvaluateAsync executes a JavaScript function and returns immediately.
// Execution is delayed by delay. No value is returned.
|
[
"EvaluateAsync",
"executes",
"a",
"JavaScript",
"function",
"and",
"returns",
"immediately",
".",
"Execution",
"is",
"delayed",
"by",
"delay",
".",
"No",
"value",
"is",
"returned",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L781-L783
|
3,881 |
benbjohnson/phantomjs
|
phantomjs.go
|
EvaluateJavaScript
|
func (p *WebPage) EvaluateJavaScript(script string) (interface{}, error) {
var resp struct {
ReturnValue interface{} `json:"returnValue"`
}
if err := p.ref.process.doJSON("POST", "/webpage/EvaluateJavaScript", map[string]interface{}{"ref": p.ref.id, "script": script}, &resp); err != nil {
return nil, err
}
return resp.ReturnValue, nil
}
|
go
|
func (p *WebPage) EvaluateJavaScript(script string) (interface{}, error) {
var resp struct {
ReturnValue interface{} `json:"returnValue"`
}
if err := p.ref.process.doJSON("POST", "/webpage/EvaluateJavaScript", map[string]interface{}{"ref": p.ref.id, "script": script}, &resp); err != nil {
return nil, err
}
return resp.ReturnValue, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"EvaluateJavaScript",
"(",
"script",
"string",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"ReturnValue",
"interface",
"{",
"}",
"`json:\"returnValue\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"script",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"ReturnValue",
",",
"nil",
"\n",
"}"
] |
// EvaluateJavaScript executes a JavaScript function.
// Returns the value returned by the function.
|
[
"EvaluateJavaScript",
"executes",
"a",
"JavaScript",
"function",
".",
"Returns",
"the",
"value",
"returned",
"by",
"the",
"function",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L787-L795
|
3,882 |
benbjohnson/phantomjs
|
phantomjs.go
|
Page
|
func (p *WebPage) Page(name string) (*WebPage, error) {
var resp struct {
Ref refJSON `json:"ref"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Page", map[string]interface{}{"ref": p.ref.id, "name": name}, &resp); err != nil {
return nil, err
}
if resp.Ref.ID == "" {
return nil, nil
}
return &WebPage{ref: newRef(p.ref.process, resp.Ref.ID)}, nil
}
|
go
|
func (p *WebPage) Page(name string) (*WebPage, error) {
var resp struct {
Ref refJSON `json:"ref"`
}
if err := p.ref.process.doJSON("POST", "/webpage/Page", map[string]interface{}{"ref": p.ref.id, "name": name}, &resp); err != nil {
return nil, err
}
if resp.Ref.ID == "" {
return nil, nil
}
return &WebPage{ref: newRef(p.ref.process, resp.Ref.ID)}, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Page",
"(",
"name",
"string",
")",
"(",
"*",
"WebPage",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"Ref",
"refJSON",
"`json:\"ref\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"name",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n",
"if",
"resp",
".",
"Ref",
".",
"ID",
"==",
"\"",
"\"",
"{",
"return",
"nil",
",",
"nil",
"\n",
"}",
"\n",
"return",
"&",
"WebPage",
"{",
"ref",
":",
"newRef",
"(",
"p",
".",
"ref",
".",
"process",
",",
"resp",
".",
"Ref",
".",
"ID",
")",
"}",
",",
"nil",
"\n",
"}"
] |
// Page returns an owned page by window name.
// Returns nil if the page cannot be found.
|
[
"Page",
"returns",
"an",
"owned",
"page",
"by",
"window",
"name",
".",
"Returns",
"nil",
"if",
"the",
"page",
"cannot",
"be",
"found",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L811-L822
|
3,883 |
benbjohnson/phantomjs
|
phantomjs.go
|
Go
|
func (p *WebPage) Go(index int) error {
return p.ref.process.doJSON("POST", "/webpage/Go", map[string]interface{}{"ref": p.ref.id, "index": index}, nil)
}
|
go
|
func (p *WebPage) Go(index int) error {
return p.ref.process.doJSON("POST", "/webpage/Go", map[string]interface{}{"ref": p.ref.id, "index": index}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Go",
"(",
"index",
"int",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"index",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// Go navigates to the page in history by relative offset.
// A positive index moves forward, a negative index moves backwards.
|
[
"Go",
"navigates",
"to",
"the",
"page",
"in",
"history",
"by",
"relative",
"offset",
".",
"A",
"positive",
"index",
"moves",
"forward",
"a",
"negative",
"index",
"moves",
"backwards",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L836-L838
|
3,884 |
benbjohnson/phantomjs
|
phantomjs.go
|
IncludeJS
|
func (p *WebPage) IncludeJS(url string) error {
return p.ref.process.doJSON("POST", "/webpage/IncludeJS", map[string]interface{}{"ref": p.ref.id, "url": url}, nil)
}
|
go
|
func (p *WebPage) IncludeJS(url string) error {
return p.ref.process.doJSON("POST", "/webpage/IncludeJS", map[string]interface{}{"ref": p.ref.id, "url": url}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"IncludeJS",
"(",
"url",
"string",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"url",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// IncludeJS includes an external script from url.
// Returns after the script has been loaded.
|
[
"IncludeJS",
"includes",
"an",
"external",
"script",
"from",
"url",
".",
"Returns",
"after",
"the",
"script",
"has",
"been",
"loaded",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L842-L844
|
3,885 |
benbjohnson/phantomjs
|
phantomjs.go
|
RenderBase64
|
func (p *WebPage) RenderBase64(format string) (string, error) {
var resp struct {
ReturnValue string `json:"returnValue"`
}
if err := p.ref.process.doJSON("POST", "/webpage/RenderBase64", map[string]interface{}{"ref": p.ref.id, "format": format}, &resp); err != nil {
return "", err
}
return resp.ReturnValue, nil
}
|
go
|
func (p *WebPage) RenderBase64(format string) (string, error) {
var resp struct {
ReturnValue string `json:"returnValue"`
}
if err := p.ref.process.doJSON("POST", "/webpage/RenderBase64", map[string]interface{}{"ref": p.ref.id, "format": format}, &resp); err != nil {
return "", err
}
return resp.ReturnValue, nil
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"RenderBase64",
"(",
"format",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"var",
"resp",
"struct",
"{",
"ReturnValue",
"string",
"`json:\"returnValue\"`",
"\n",
"}",
"\n",
"if",
"err",
":=",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"format",
"}",
",",
"&",
"resp",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
",",
"err",
"\n",
"}",
"\n",
"return",
"resp",
".",
"ReturnValue",
",",
"nil",
"\n",
"}"
] |
// RenderBase64 renders the web page to a base64 encoded string.
|
[
"RenderBase64",
"renders",
"the",
"web",
"page",
"to",
"a",
"base64",
"encoded",
"string",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L869-L877
|
3,886 |
benbjohnson/phantomjs
|
phantomjs.go
|
Render
|
func (p *WebPage) Render(filename, format string, quality int) error {
req := map[string]interface{}{"ref": p.ref.id, "filename": filename, "format": format, "quality": quality}
return p.ref.process.doJSON("POST", "/webpage/Render", req, nil)
}
|
go
|
func (p *WebPage) Render(filename, format string, quality int) error {
req := map[string]interface{}{"ref": p.ref.id, "filename": filename, "format": format, "quality": quality}
return p.ref.process.doJSON("POST", "/webpage/Render", req, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"Render",
"(",
"filename",
",",
"format",
"string",
",",
"quality",
"int",
")",
"error",
"{",
"req",
":=",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"filename",
",",
"\"",
"\"",
":",
"format",
",",
"\"",
"\"",
":",
"quality",
"}",
"\n",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"req",
",",
"nil",
")",
"\n",
"}"
] |
// Render renders the web page to a file with the given format and quality settings.
// This supports the "PDF", "PNG", "JPEG", "BMP", "PPM", and "GIF" formats.
|
[
"Render",
"renders",
"the",
"web",
"page",
"to",
"a",
"file",
"with",
"the",
"given",
"format",
"and",
"quality",
"settings",
".",
"This",
"supports",
"the",
"PDF",
"PNG",
"JPEG",
"BMP",
"PPM",
"and",
"GIF",
"formats",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L881-L884
|
3,887 |
benbjohnson/phantomjs
|
phantomjs.go
|
SetContentAndURL
|
func (p *WebPage) SetContentAndURL(content, url string) error {
return p.ref.process.doJSON("POST", "/webpage/SetContentAndURL", map[string]interface{}{"ref": p.ref.id, "content": content, "url": url}, nil)
}
|
go
|
func (p *WebPage) SetContentAndURL(content, url string) error {
return p.ref.process.doJSON("POST", "/webpage/SetContentAndURL", map[string]interface{}{"ref": p.ref.id, "content": content, "url": url}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SetContentAndURL",
"(",
"content",
",",
"url",
"string",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"content",
",",
"\"",
"\"",
":",
"url",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SetContentAndURL sets the content and URL of the page.
|
[
"SetContentAndURL",
"sets",
"the",
"content",
"and",
"URL",
"of",
"the",
"page",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L910-L912
|
3,888 |
benbjohnson/phantomjs
|
phantomjs.go
|
SwitchToFrameName
|
func (p *WebPage) SwitchToFrameName(name string) error {
return p.ref.process.doJSON("POST", "/webpage/SwitchToFrameName", map[string]interface{}{"ref": p.ref.id, "name": name}, nil)
}
|
go
|
func (p *WebPage) SwitchToFrameName(name string) error {
return p.ref.process.doJSON("POST", "/webpage/SwitchToFrameName", map[string]interface{}{"ref": p.ref.id, "name": name}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SwitchToFrameName",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"name",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SwitchToFrameName changes the current frame to a frame with a given name.
|
[
"SwitchToFrameName",
"changes",
"the",
"current",
"frame",
"to",
"a",
"frame",
"with",
"a",
"given",
"name",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L925-L927
|
3,889 |
benbjohnson/phantomjs
|
phantomjs.go
|
SwitchToFramePosition
|
func (p *WebPage) SwitchToFramePosition(pos int) error {
return p.ref.process.doJSON("POST", "/webpage/SwitchToFramePosition", map[string]interface{}{"ref": p.ref.id, "position": pos}, nil)
}
|
go
|
func (p *WebPage) SwitchToFramePosition(pos int) error {
return p.ref.process.doJSON("POST", "/webpage/SwitchToFramePosition", map[string]interface{}{"ref": p.ref.id, "position": pos}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SwitchToFramePosition",
"(",
"pos",
"int",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"pos",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SwitchToFramePosition changes the current frame to the frame at the given position.
|
[
"SwitchToFramePosition",
"changes",
"the",
"current",
"frame",
"to",
"the",
"frame",
"at",
"the",
"given",
"position",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L930-L932
|
3,890 |
benbjohnson/phantomjs
|
phantomjs.go
|
SwitchToParentFrame
|
func (p *WebPage) SwitchToParentFrame() error {
return p.ref.process.doJSON("POST", "/webpage/SwitchToParentFrame", map[string]interface{}{"ref": p.ref.id}, nil)
}
|
go
|
func (p *WebPage) SwitchToParentFrame() error {
return p.ref.process.doJSON("POST", "/webpage/SwitchToParentFrame", map[string]interface{}{"ref": p.ref.id}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"SwitchToParentFrame",
"(",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// SwitchToParentFrame switches the current frame to the parent of the current frame.
|
[
"SwitchToParentFrame",
"switches",
"the",
"current",
"frame",
"to",
"the",
"parent",
"of",
"the",
"current",
"frame",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L940-L942
|
3,891 |
benbjohnson/phantomjs
|
phantomjs.go
|
UploadFile
|
func (p *WebPage) UploadFile(selector, filename string) error {
return p.ref.process.doJSON("POST", "/webpage/UploadFile", map[string]interface{}{"ref": p.ref.id, "selector": selector, "filename": filename}, nil)
}
|
go
|
func (p *WebPage) UploadFile(selector, filename string) error {
return p.ref.process.doJSON("POST", "/webpage/UploadFile", map[string]interface{}{"ref": p.ref.id, "selector": selector, "filename": filename}, nil)
}
|
[
"func",
"(",
"p",
"*",
"WebPage",
")",
"UploadFile",
"(",
"selector",
",",
"filename",
"string",
")",
"error",
"{",
"return",
"p",
".",
"ref",
".",
"process",
".",
"doJSON",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"map",
"[",
"string",
"]",
"interface",
"{",
"}",
"{",
"\"",
"\"",
":",
"p",
".",
"ref",
".",
"id",
",",
"\"",
"\"",
":",
"selector",
",",
"\"",
"\"",
":",
"filename",
"}",
",",
"nil",
")",
"\n",
"}"
] |
// UploadFile uploads a file to a form element specified by selector.
|
[
"UploadFile",
"uploads",
"a",
"file",
"to",
"a",
"form",
"element",
"specified",
"by",
"selector",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L945-L947
|
3,892 |
benbjohnson/phantomjs
|
phantomjs.go
|
newRef
|
func newRef(p *Process, id string) *Ref {
return &Ref{process: p, id: id}
}
|
go
|
func newRef(p *Process, id string) *Ref {
return &Ref{process: p, id: id}
}
|
[
"func",
"newRef",
"(",
"p",
"*",
"Process",
",",
"id",
"string",
")",
"*",
"Ref",
"{",
"return",
"&",
"Ref",
"{",
"process",
":",
"p",
",",
"id",
":",
"id",
"}",
"\n",
"}"
] |
// newRef returns a new instance of a referenced object within the process.
|
[
"newRef",
"returns",
"a",
"new",
"instance",
"of",
"a",
"referenced",
"object",
"within",
"the",
"process",
"."
] |
6499a20f5cd6e4264994b4d95e49b6f21aafef79
|
https://github.com/benbjohnson/phantomjs/blob/6499a20f5cd6e4264994b4d95e49b6f21aafef79/phantomjs.go#L961-L963
|
3,893 |
go-openapi/swag
|
util.go
|
split
|
func split(str string) []string {
// check if consecutive single char things make up an initialism
once.Do(func() {
splitRex1 = regexp.MustCompile(`(\p{Lu})`)
splitRex2 = regexp.MustCompile(`(\pL|\pM|\pN|\p{Pc})+`)
splitReplacer = strings.NewReplacer(
"@", "At ",
"&", "And ",
"|", "Pipe ",
"$", "Dollar ",
"!", "Bang ",
"-", " ",
"_", " ",
)
ensureSorted()
})
str = trim(str)
// Convert dash and underscore to spaces
str = splitReplacer.Replace(str)
// Split when uppercase is found (needed for Snake)
str = splitRex1.ReplaceAllString(str, " $1")
for _, k := range initialisms {
str = strings.Replace(str, splitRex1.ReplaceAllString(k, " $1"), " "+k, -1)
}
// Get the final list of words
//words = rex2.FindAllString(str, -1)
return splitRex2.FindAllString(str, -1)
}
|
go
|
func split(str string) []string {
// check if consecutive single char things make up an initialism
once.Do(func() {
splitRex1 = regexp.MustCompile(`(\p{Lu})`)
splitRex2 = regexp.MustCompile(`(\pL|\pM|\pN|\p{Pc})+`)
splitReplacer = strings.NewReplacer(
"@", "At ",
"&", "And ",
"|", "Pipe ",
"$", "Dollar ",
"!", "Bang ",
"-", " ",
"_", " ",
)
ensureSorted()
})
str = trim(str)
// Convert dash and underscore to spaces
str = splitReplacer.Replace(str)
// Split when uppercase is found (needed for Snake)
str = splitRex1.ReplaceAllString(str, " $1")
for _, k := range initialisms {
str = strings.Replace(str, splitRex1.ReplaceAllString(k, " $1"), " "+k, -1)
}
// Get the final list of words
//words = rex2.FindAllString(str, -1)
return splitRex2.FindAllString(str, -1)
}
|
[
"func",
"split",
"(",
"str",
"string",
")",
"[",
"]",
"string",
"{",
"// check if consecutive single char things make up an initialism",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"splitRex1",
"=",
"regexp",
".",
"MustCompile",
"(",
"`(\\p{Lu})`",
")",
"\n",
"splitRex2",
"=",
"regexp",
".",
"MustCompile",
"(",
"`(\\pL|\\pM|\\pN|\\p{Pc})+`",
")",
"\n",
"splitReplacer",
"=",
"strings",
".",
"NewReplacer",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
")",
"\n",
"ensureSorted",
"(",
")",
"\n",
"}",
")",
"\n\n",
"str",
"=",
"trim",
"(",
"str",
")",
"\n\n",
"// Convert dash and underscore to spaces",
"str",
"=",
"splitReplacer",
".",
"Replace",
"(",
"str",
")",
"\n\n",
"// Split when uppercase is found (needed for Snake)",
"str",
"=",
"splitRex1",
".",
"ReplaceAllString",
"(",
"str",
",",
"\"",
"\"",
")",
"\n\n",
"for",
"_",
",",
"k",
":=",
"range",
"initialisms",
"{",
"str",
"=",
"strings",
".",
"Replace",
"(",
"str",
",",
"splitRex1",
".",
"ReplaceAllString",
"(",
"k",
",",
"\"",
"\"",
")",
",",
"\"",
"\"",
"+",
"k",
",",
"-",
"1",
")",
"\n",
"}",
"\n",
"// Get the final list of words",
"//words = rex2.FindAllString(str, -1)",
"return",
"splitRex2",
".",
"FindAllString",
"(",
"str",
",",
"-",
"1",
")",
"\n",
"}"
] |
// Prepares strings by splitting by caps, spaces, dashes, and underscore
|
[
"Prepares",
"strings",
"by",
"splitting",
"by",
"caps",
"spaces",
"dashes",
"and",
"underscore"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L179-L210
|
3,894 |
go-openapi/swag
|
util.go
|
Camelize
|
func Camelize(word string) (camelized string) {
for pos, ru := range []rune(word) {
if pos > 0 {
camelized += string(unicode.ToLower(ru))
} else {
camelized += string(unicode.ToUpper(ru))
}
}
return
}
|
go
|
func Camelize(word string) (camelized string) {
for pos, ru := range []rune(word) {
if pos > 0 {
camelized += string(unicode.ToLower(ru))
} else {
camelized += string(unicode.ToUpper(ru))
}
}
return
}
|
[
"func",
"Camelize",
"(",
"word",
"string",
")",
"(",
"camelized",
"string",
")",
"{",
"for",
"pos",
",",
"ru",
":=",
"range",
"[",
"]",
"rune",
"(",
"word",
")",
"{",
"if",
"pos",
">",
"0",
"{",
"camelized",
"+=",
"string",
"(",
"unicode",
".",
"ToLower",
"(",
"ru",
")",
")",
"\n",
"}",
"else",
"{",
"camelized",
"+=",
"string",
"(",
"unicode",
".",
"ToUpper",
"(",
"ru",
")",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"\n",
"}"
] |
// Camelize an uppercased word
|
[
"Camelize",
"an",
"uppercased",
"word"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L228-L237
|
3,895 |
go-openapi/swag
|
util.go
|
ToFileName
|
func ToFileName(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
out = append(out, lower(w))
}
return strings.Join(out, "_")
}
|
go
|
func ToFileName(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
out = append(out, lower(w))
}
return strings.Join(out, "_")
}
|
[
"func",
"ToFileName",
"(",
"name",
"string",
")",
"string",
"{",
"in",
":=",
"split",
"(",
"name",
")",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"in",
")",
")",
"\n\n",
"for",
"_",
",",
"w",
":=",
"range",
"in",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"lower",
"(",
"w",
")",
")",
"\n",
"}",
"\n\n",
"return",
"strings",
".",
"Join",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
// ToFileName lowercases and underscores a go type name
|
[
"ToFileName",
"lowercases",
"and",
"underscores",
"a",
"go",
"type",
"name"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L240-L249
|
3,896 |
go-openapi/swag
|
util.go
|
ToHumanNameLower
|
func ToHumanNameLower(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
if !isInitialism(upper(w)) {
out = append(out, lower(w))
} else {
out = append(out, w)
}
}
return strings.Join(out, " ")
}
|
go
|
func ToHumanNameLower(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
if !isInitialism(upper(w)) {
out = append(out, lower(w))
} else {
out = append(out, w)
}
}
return strings.Join(out, " ")
}
|
[
"func",
"ToHumanNameLower",
"(",
"name",
"string",
")",
"string",
"{",
"in",
":=",
"split",
"(",
"name",
")",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"in",
")",
")",
"\n\n",
"for",
"_",
",",
"w",
":=",
"range",
"in",
"{",
"if",
"!",
"isInitialism",
"(",
"upper",
"(",
"w",
")",
")",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"lower",
"(",
"w",
")",
")",
"\n",
"}",
"else",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"w",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
// ToHumanNameLower represents a code name as a human series of words
|
[
"ToHumanNameLower",
"represents",
"a",
"code",
"name",
"as",
"a",
"human",
"series",
"of",
"words"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L263-L275
|
3,897 |
go-openapi/swag
|
util.go
|
ToHumanNameTitle
|
func ToHumanNameTitle(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
uw := upper(w)
if !isInitialism(uw) {
out = append(out, Camelize(w))
} else {
out = append(out, w)
}
}
return strings.Join(out, " ")
}
|
go
|
func ToHumanNameTitle(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for _, w := range in {
uw := upper(w)
if !isInitialism(uw) {
out = append(out, Camelize(w))
} else {
out = append(out, w)
}
}
return strings.Join(out, " ")
}
|
[
"func",
"ToHumanNameTitle",
"(",
"name",
"string",
")",
"string",
"{",
"in",
":=",
"split",
"(",
"name",
")",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"in",
")",
")",
"\n\n",
"for",
"_",
",",
"w",
":=",
"range",
"in",
"{",
"uw",
":=",
"upper",
"(",
"w",
")",
"\n",
"if",
"!",
"isInitialism",
"(",
"uw",
")",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"Camelize",
"(",
"w",
")",
")",
"\n",
"}",
"else",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"w",
")",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
// ToHumanNameTitle represents a code name as a human series of words with the first letters titleized
|
[
"ToHumanNameTitle",
"represents",
"a",
"code",
"name",
"as",
"a",
"human",
"series",
"of",
"words",
"with",
"the",
"first",
"letters",
"titleized"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L278-L291
|
3,898 |
go-openapi/swag
|
util.go
|
ToJSONName
|
func ToJSONName(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for i, w := range in {
if i == 0 {
out = append(out, lower(w))
continue
}
out = append(out, Camelize(w))
}
return strings.Join(out, "")
}
|
go
|
func ToJSONName(name string) string {
in := split(name)
out := make([]string, 0, len(in))
for i, w := range in {
if i == 0 {
out = append(out, lower(w))
continue
}
out = append(out, Camelize(w))
}
return strings.Join(out, "")
}
|
[
"func",
"ToJSONName",
"(",
"name",
"string",
")",
"string",
"{",
"in",
":=",
"split",
"(",
"name",
")",
"\n",
"out",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"in",
")",
")",
"\n\n",
"for",
"i",
",",
"w",
":=",
"range",
"in",
"{",
"if",
"i",
"==",
"0",
"{",
"out",
"=",
"append",
"(",
"out",
",",
"lower",
"(",
"w",
")",
")",
"\n",
"continue",
"\n",
"}",
"\n",
"out",
"=",
"append",
"(",
"out",
",",
"Camelize",
"(",
"w",
")",
")",
"\n",
"}",
"\n",
"return",
"strings",
".",
"Join",
"(",
"out",
",",
"\"",
"\"",
")",
"\n",
"}"
] |
// ToJSONName camelcases a name which can be underscored or pascal cased
|
[
"ToJSONName",
"camelcases",
"a",
"name",
"which",
"can",
"be",
"underscored",
"or",
"pascal",
"cased"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L294-L306
|
3,899 |
go-openapi/swag
|
util.go
|
ToVarName
|
func ToVarName(name string) string {
res := ToGoName(name)
if isInitialism(res) {
return lower(res)
}
if len(res) <= 1 {
return lower(res)
}
return lower(res[:1]) + res[1:]
}
|
go
|
func ToVarName(name string) string {
res := ToGoName(name)
if isInitialism(res) {
return lower(res)
}
if len(res) <= 1 {
return lower(res)
}
return lower(res[:1]) + res[1:]
}
|
[
"func",
"ToVarName",
"(",
"name",
"string",
")",
"string",
"{",
"res",
":=",
"ToGoName",
"(",
"name",
")",
"\n",
"if",
"isInitialism",
"(",
"res",
")",
"{",
"return",
"lower",
"(",
"res",
")",
"\n",
"}",
"\n",
"if",
"len",
"(",
"res",
")",
"<=",
"1",
"{",
"return",
"lower",
"(",
"res",
")",
"\n",
"}",
"\n",
"return",
"lower",
"(",
"res",
"[",
":",
"1",
"]",
")",
"+",
"res",
"[",
"1",
":",
"]",
"\n",
"}"
] |
// ToVarName camelcases a name which can be underscored or pascal cased
|
[
"ToVarName",
"camelcases",
"a",
"name",
"which",
"can",
"be",
"underscored",
"or",
"pascal",
"cased"
] |
b3e2804c8535ee0d1b89320afd98474d5b8e9e3b
|
https://github.com/go-openapi/swag/blob/b3e2804c8535ee0d1b89320afd98474d5b8e9e3b/util.go#L309-L318
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.