Skip to content

galziv/jSniff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jSniff

jSniff is a javascript libary which helps you to sniff functions. When function is sniffed its execution date and parameters are logged by jSniff. In addition, a custom function can be injected to the sniffed function to execute before the original code.
*important: a sniffed function can still be debugged in devTools and its execution will work as if it was not sniffed.

Check jSniff's .NET port to be used with Selenium WebDriver - jSniff.NET

How to use


add script tag to your website:
<script type="text/javascript" src="jSniff.js"></script>

sniff the function using:
jSniff.sniffify

function (obj, funcName, sniffName, customFunc)
  • obj: The object on which the function exists (if it is a function declaration then use window)
  • funcName: The name of the function
  • sniffName: The name for the sniff. It is later used when retrieving the invocations data
  • customFunc: A custom function which will be executed prior to the original function's code

lets assume we have a function declaration as follows:

function multiply(a,b){
    return a*b;
}

so to sniff it we execute:

jSniff.sniffify(window, 'multiply', 'window_multiply', function() { console.log('hello jSniff');} );

retrieve sniffed data using:
jSniff.getInvocations

function getInvocations (sniffName)

This method returns an array of invocations sniffed data. Invocation sniffed data is an object with two properties:

  • executionDate: Javascript Date object with the execution date.
  • params: Array of the execution parameters. Each element in array is an array for itself with two elements. First element is the name of the parameter and the second is its value

jSniff.getLastInvocation

function getLastInvocation (sniffName)

This method returns the last execution sniffed data. the returned object has two properties:

  • executionDate: Javascript Date object with the execution date.
  • params: Array of the execution parameters. Each element in array is an array for itself with two elements. First element is the name of the parameter and the second is its value

jSniff.getInvocations

function getLastInvocationParams (sniffName)

This method returns an array of the last execution parameters. Each element in the array is an array for itself with two elements. First element is the name of the parameter and the second is its value

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published