예제 #1
0
flusspferd::string JS_sqlEncodeQuoteDate(flusspferd::object dateTime)
{
	flusspferd::value timeMillisecondsVal = dateTime.call("getTime");
	long long timeMilliseconds = (long long)timeMillisecondsVal.get_double();

	return std::string("'") + MiscUtil::formatDateYYYYdmmdddHHcMMcSS(DateTime(timeMilliseconds / 1000)) + std::string("'");
	
}
예제 #2
0
void JS_setTimeout(unsigned int pulses, flusspferd::value callback, flusspferd::object arguments)
{
	if(!callback.is_function())
		throw flusspferd::exception("Value is not a function.");
	if(!arguments.is_array())
		arguments = flusspferd::object();
	
	ScriptEvent *scriptEvent = new ScriptEvent(pulses, callback, arguments, JSManager::get()->getNextScriptEventId());
	JSManager::get()->addScriptEvent(scriptEvent);

	//We must root the callback and its arguments.

	flusspferd::object scriptEventObject = flusspferd::create_object();

	scriptEventObject.set_property("callback", callback);
	scriptEventObject.set_property("arguments", arguments);

	flusspferd::global().set_property(scriptEvent->propertyName, scriptEventObject);
}
예제 #3
0
// This function prints the contents of 'this' on the screen.
void print_object(flusspferd::object &o) {
    std::cout << o.call("toSource") << '\n';
}