0.0.3 • Published 8 years ago

media-detect v0.0.3

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

#Media Detect

Media-Detect is a tool that listens global window creation/destruction and fires callbacks accordingly. Only works on Windows for now. On Windows the library hooks into shell using RegisterShellHookWindow then listens shell messages and fires javascript callbacks.

npm.io

#Usage

Require the module and simply create an object then register the callback you'd like to listen.

var NativeMD = require('media-detect').MediaDetect;

var MediaDetect = new NativeMD();

//Called when a new window created,i.e., you launch a program/explorer
MediaDetect.SetWindowCreateCallback( function(arg) { //Arg will be [WindowName,WindowId]
  //...
});

//Called when a window is activated
MediaDetect.SetWindowActivateCallback( function(arg) { //Arg will be [WindowName,WindowId]
  //...
});

//Called when a window closed/destroyed
MediaDetect.SetWindowCloseCallback( function(arg) { //Arg will be [WindowName,WindowId]
  //...
});

//Called when a window changes monitor
MediaDetect.SetWindowMonitorChangeCallback( function(arg) { //Arg will be [WindowName,WindowId]
  //...
});

#Tests

Install npm i jasmine-node then run npm test. Then launch some windows/apps and see the output.

npm.io

#Installing

npm install media-detect

You'll need

-MSVC for Windows (Visual Studio 2013) -node-gyp -NaN

or just type npm install and NPM will build it for you.