[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/lib/scripts/ -> helpers.js (summary)

Various helper functions

File Size: 69 lines (2 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 3 functions

  substr_replace()
  bind()
  logError()

Functions
Functions that are not part of a class:

substr_replace(str, replace, start, length)   X-Ref
A PHP-style substr_replace

Supports negative start and length and omitting length, but not
str and replace arrays.
See http://php.net/substr-replace for further documentation.

bind(fnc)   X-Ref
Bind variables to a function call creating a closure

Use this to circumvent variable scope problems when creating closures
inside a loop

link: http://www.cosmocode.de/en/blog/gohr/2009-10/15-javascript-fixing-the-closure-scope-in-loops
param: functionref fnc - the function to be called
param: mixed - any arguments to be passed to the function
returns: functionref
author: Adrian Lang <lang@cosmocode.de>

logError(e, file)   X-Ref
Report an error from a JS file to the console

param: e    The error object
param: file The file in which the error occurred