English 中文(简体)
你们是否知道任何带有许多前提的 j印? 如同人工情报
原标题:do you know any javascript api with many premise handling? like in artificial intelligence

J. 住房可处理实施的活动 观察员设计模式,但只能处理一次追索活动。

我很想知道,它是否能够处理许多事件:当所有这些事件都发生时,或者当所有的美术馆舍都变成现实时,它就称为一种功能。

更好地开发动态应用

Do you know if already exist something like that? If not: do you think it would be nice if i develop?

EDIT: i would like to do something like this:

when((a==b && c!=0), function(){ 
//do something when a==b and c!=0
alert("a==b && c!=0");
});

EDIT:

我发现了一个伟大的促动体,能够倾听变化。 你必须做这样的事情:

obj.watch(function(){
alert("obj changes");
});

http://watch.k6.com.br/

问题回答

Promises to me。 根据这一概念开发的大多数图书馆(许多位于贾瓦伦的图书馆,包括被挑选的图书馆)只能为某些其他图书馆所完成的活动建立新的宣传。

You can easily do this manually:

var flag1 = false;
var flag2 = false;
var flag3 = false;
var checkAllFlags = function () {
    if (!flag1 || !flag2 || !flag3) return;
    checkAllFlags = function () { };
    allFlagsSet();
}
var allFlagsSet = function () {
    // Execute here when all flags are set
}

// When you set a flag do it like this:
flag2 = true;
checkAllFlags();

或者你可以使用这一类:

window.flagger = function (count, callback, once) {
    var curr = this;
    curr.callback = callback;
    if (once)
        curr.called = false;
    curr.flags = [];
    curr.flagsLeft = count;
    for (var i = 0; i < count; i++)
        curr.flags[i] = false;

    this.flag = function (index) {
        if (!curr.flags[index]) {
            curr.flags[index] = true;
            if (--curr.flagsLeft <= 0 && (!once || !curr.called)) {
                if (once) curr.called = true;
                curr.callback();
            }
        }
    };
    this.unflag = function (index) {
        if (curr.flags[index]) {
            curr.flags[index] = false;
            curr.flagsLeft++;
        }
    };
    this.reset = function (force) {
        for (var i = 0; i < count; i++)
            curr.flags[i] = false;
        curr.flagsLeft = count;
        if (once && force)
            curr.called = false;
    };
    this.isFlagged = function (index) {
        return curr.flags[index];
    };
}

并如此:

var myFlagger = new flagger(
    /* The amount of flags that need to be set: */8,
    /* The function that needs to be called when the flags are all set: */
    function () { alert( Callback function called ); },
    /* If the callback function should be called again when a flag is unflagged and reflagged.
       Optional. Default: false */false);

// You can now use these functions:
myFlagger.flag(0); // Use this to set a flag, index ranges from 0 to count - 1.
myFlagger.unflag(0); // Unflags an index.
myFlagger.reset(); // Resets all flags to false.
myFlagger.reset(true); // Using this forces the reset, returning to full start
                       // state, causes callback function to be called again
                       // even if  once  is specified.
alert( 0 is flagged:   + myFlagger.isFlagged(1)); // Returns if flag is flagged.

我希望这在一定程度上有助于你。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签