npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lcsesw

v0.0.2

Published

interface library for es-series

Downloads

1

Readme

NODE.JS�̃A�h�I�����W���[���쐬

�r���h�‹��̍\�z

MacOSxLion �̃P�[�X

node.js�̃o�[�W������v.0.8�ȏ��ŁApython v2�ȏ��ł��邱�ƁB

$ node -v
v0.8.12

$ python -V
Python 2.7.1

node-gyp��npm�ŃO���[�o���C���X�g�[�����܂��B

$ sudo npm install -g node-gyp

�T���v���̃r���h���”\��?

NODE.JS�̃\�[�X�ɓY�t�����Ă����T���v���\�[�X���r���h�”\���m�F���܂��B

$ cd /Users/sin0414/nvm/src/node-v0.8.9/test/addons/hello-world

test.js�������ɓ����΃r���h�‹��͐����ɍ\�z�ł��Ă����B

hello-world $ node test.js
binding.hello() = world

�I���W�i���̃e�X�g���W���[���쐬

�܂��A���W���[���t�@�C�� hello.cc ���쐬���܂��B �t�@�C�����͂Ȃ��ł��悭�A�g���q��cc�Ƃ��܂��B

#include <node.h>
#include <v8.h>

using namespace v8;

Handle<Value> sayWhat(const Arguments& args) {
  HandleScope scope;
        return scope.Close(String::New("what your name!!"));
}
Handle<Value> sayHello(const Arguments& args) {
  HandleScope scope;
    return scope.Close(String::New("Hello 	world!!"));
}

void init(Handle<Object> target) {
	target->Set(String::NewSymbol("sayWhat"),
        FunctionTemplate::New(sayWhat)->GetFunction());

	target->Set(String::NewSymbol("sayHello"),
        FunctionTemplate::New(sayHello)->GetFunction());
}
NODE_MODULE(hello, init);

binding.gyp�t�@�C���̍쐬

���W���[����make�����Ƃ��ɕK�v�ȃt�@�C���ł��B�t�@�C������binding.gyp�łȂ����΂Ȃ��܂����B

{
    "targets": [
    {
        "target_name": "hello",
            "sources": ["hello.cc"]
    }
    ]
}

�Ō��ɏ��̃��W���[�����g�p����javascript�t�@�C��test.js���쐬���܂��B

var lcsEsw = require('./build/Release/hello');
console.log('hello() = ' + lcsEsw.sayHello());
console.log('what() = ' + lcsEsw.sayWhat());

���W���[���̃r���h

�쐬�����t�@�C�����r���h���܂��B

 $ node-gyp configure build

�r���h�����󂷂��ƁA./build/Release/��hello.node���ł��Ă��܂��B

���W���[���̓����m�F

$ node test

hello() = Hello world!!
what() = what your name!!
 

�Q�l https://c9.io/leeolayvar/fenearstreamer/workspace/node_modules/forever/node_modules/daemon/src/daemon.cc

win32 API�g�p��

lcsesw.cc

#include <node.h>  
#include <v8.h>
#include <stdlib.h>
#include <string.h>

using namespace v8;
#define FALSE	0
#define TRUE	1
#define ACCESS_ALL	1
/*
 * Send message into mailbox and/or turn on event flag
 */
Handle<Value> fnFoward(const Arguments& args) {
	HandleScope scope;
	HANDLE hmbx;
	DWORD len, cnt = 0;
	char message[256];

	if (args.Length() < 2) {
		return scope.Close(Boolean::New(false));
	}
	memset(message, 0, sizeof(message));
	len = args[1]->Int32Value();
	if (len < 1) {
		return ThrowException(Exception::Error(
				String::New("Error invalid length")));
	}
	strcpy(message, *String::Utf8Value(args[0]));

	while (TRUE) {
		hmbx = CreateFile("\\\\.\\mailslot\\SYSMSG",
			GENERIC_WRITE,
			FILE_SHARE_READ,
			(LPSECURITY_ATTRIBUTES)NULL,
			OPEN_EXISTING,
			FILE_ATTRIBUTE_NORMAL,
			(HANDLE)NULL );

		if ( hmbx == INVALID_HANDLE_VALUE ) {
			cnt++;
			if ( cnt > 5 ) {
				return scope.Close(Boolean::New(false));
			}
			Sleep(30);
			continue;
		}
		break;
	}
	if (! WriteFile(hmbx, message,
				len,
				&len, (LPOVERLAPPED)NULL )) {
		return scope.Close(Boolean::New(false));
	}
	return scope.Close(Boolean::New(true));
}
extern "C"
void init(Handle<Object> target) {

	NODE_SET_METHOD(target, "send", fnFoward);
}
NODE_MODULE(lcsesw, init);

binding.gyp

{
	"targets": [
	{
    	"target_name": "lcsEsw",
        	"sources": ["lcsesw.cc"]
	}
	]
}

test.js

var lcsEsw = require('./build/Release/lcsesw');
try {
	lcsEsw.send('qwer tyu');
} catch(e) {
	console.log('error' +e.message);
}
console.log('send message');

���s���Ă݂��B

$ node test.js
send message

$ log trace -l 10

2012/10/25 08:00:10.000 [lcsEsw.send]