Skip to content

Instantly share code, notes, and snippets.

Avatar

Kouji Nakashima kuc-arc-f

View GitHub Profile
View c0606-db1-top1.htm
<form name="form1">
id (int):
<input type="text" id="id-text-id" value=""></input ><br />
name:
<input type="text" id="id-text-name" value=""></input ><br />
kana:
<input type="text" id="id-text-kana" value=""></input ><br />
</form><br />
<a href="#" id="id-a-add" >[ add ]</a><br />
View c0606-db1-top5.js
View.prototype.disp_init = function() {
$('ul#id-ul-out').remove();
var divOut= $('div#id-div-out');
var ulObj= $('<ul id="id-ul-out"></ul>');
divOut.append( ulObj );
};
View.prototype.disp_line = function( item ) {
// console.log( items );
View c0606-db1-top1.js
function init_proc()
{
if (window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB) {
console.log('OK: use indexedDB');
}else{
console.log('NG: use indexedDB');
}
var db= new DbHelper();
db.getInstance();
View c0606-db1-top2.js
DbHelper.prototype.getInstance = function( ) {
var db=null;
//open
var rq = indexedDB.open(DB_NAME);
rq.onupgradeneeded = function(result) {
console.log('#onupgradeneeded');
db = this.result;
var store = db.createObjectStore(STORE_NAME, {
View asm-hello-hello_world_in.c
#include <emscripten.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("hello, world!\n");
EM_ASM(
//js-call
console.log( '#hello, world-Inline-JS ');
View asm-export-export1.c
//export1.c
#include <emscripten.h>
#include <stdio.h>
#include <stdlib.h>
char* ex_func01( int a, float b, const char* c )
{
char *po= (char *)malloc(sizeof(char) * 128 );
sprintf(po, "a=%d ,b=%f ,c=%s\n", a, b, c );
View asm-export-js1.js
//test.js
onload = function(){
console.log('#onload');
var ex_func01= cwrap( 'ex_func01', 'string', ['number' ,'number' ,'string' ] );
var ret= ex_func01(1, 2.0, 'arg3');
console.log('#ret=' +ret );
}
View asm-hello-build-1
#!/bin/bash
#export EMCC_CFLAGS="-O3"
rm -rf dest/*
export EMCC_FAST_COMPILER=0
emcc hello_world.c \
-o dest/hello_world.js \
View chrome_slide-js1.js
onload = function() {
var canvas =document.getElementById('id_canvas');
var iW = canvas.width;
var iH = canvas.height;
console.log( 'iW='+ iW +',iH=' + iH)
var items= get_slideData();
var slide = new CustomSlide(1000 * 10 ,items, iW, iH );
slide.start();
View chrome_slide-js2.js
CustomSlide.load_image = function ( item, ipos) {
console.log('#load_image=' + item.url );
var xhr = new XMLHttpRequest();
xhr.open('GET', item.url );
xhr.responseType = 'blob';
xhr.onload = function() {
console.log('#r.onload,url=' + item.url );
var image = new Image();
var objURL = URL.createObjectURL(xhr.response);
image.src = objURL;