JSPM

media-detect

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q23618F
  • License ISC

Native node module for detecting global window creation/destruction

Package Exports

  • media-detect

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (media-detect) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#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.

#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.

#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.