Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kaelzhang committed Dec 12, 2017
0 parents commit b56bb4f
Show file tree
Hide file tree
Showing 22 changed files with 4,298 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parserOpts": {
// Allow returns in the module
"allowReturnOutsideFunction": true
},

"env": {
"ava": {
"sourceMaps": "inline",
"plugins": [
"transform-es2015-modules-commonjs"
]
},

"rollup": {
"plugins": []
}
}
}
60 changes: 60 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# cmake
/cmake-build-debug

# babel dist
/lib

# Numerous always-ignore extensions
*.bak
*.patch
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.zip
*.vi
*~
*.sass-cache
*.lock
*.rdb
*.db
nohup.out
.nyc_output
coverage.lcov
package-lock.json

# OS or Editor folders
.DS_Store
._*
.cache
.project
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
nbproject
thumbs.db

# Folders to ignore
.hg
.svn
.CVS
.idea
node_modules
old/
*-old/
*-notrack/
no-track/
build/
combo/
reference/
jscoverage_lib/
temp/
tmp/

# codecov.io
coverage/
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Gifx

Originally a fork of [`gif`](https://www.npmjs.com/package/gif).

NOW WIP

----
24 changes: 24 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
'targets': [
{
'target_name': 'gifx',
'sources': [
'cc/Gifx.cc'
],
'include_dirs': [
'<!(node -e "require(\'nan\')")'
],
'dependencies': [
'<(module_root_dir)/giflib/giflib.gyp:giflib'
],
'cflags_cc!': [ '-fno-exceptions' ],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
}
}]
]
}
]
}
32 changes: 32 additions & 0 deletions cc/Gifx.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include "Gifx.h"

Nan::Persistent<FunctionTemplate> Gifx::constructor;

/*
* Initialize Gifx.
*/

void
Gifx::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) {
Nan::HandleScope scope;

// Constructor
Local<FunctionTemplate> ctor = Nan::New<FunctionTemplate>(Gifx::New);
constructor.Reset(ctor);
ctor->InstanceTemplate()->SetInternalFieldCount(1);
ctor->SetClassName(Nan::New("Gifx").ToLocalChecked());

Nan::SetPrototypeMethod(ctor, "hello", Hello);
}

NAN_METHOD(Gifx::New) {
if (!info.IsConstructCall()) {
return Nan::ThrowTypeError("Class constructors cannot be invoked without 'new'");
}

info.GetReturnValue().Set(info.This());
}

NAN_METHOD(Gifx::Hello) {
info.GetReturnValue().Set(info.This());
}
22 changes: 22 additions & 0 deletions cc/Gifx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef __GIFX_GIFX_H__
#define __GIFX_GIFX_H__

#include <v8.h>
#include <nan.h>

using namespace v8;

class Gifx: public Nan::ObjectWrap {
public:
static Nan::Persistent<FunctionTemplate> constructor;
static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target);
static NAN_METHOD(New);
static NAN_METHOD(Hello);

Gifx();

private:
~Gifx();
};

#endif
Loading

0 comments on commit b56bb4f

Please sign in to comment.