@sheepdog/vanilla
Advanced tools
Comparing version
@@ -41,6 +41,3 @@ import { CancelationError, createTask, handlers } from '@sheepdog/core'; | ||
const instance = instances.get(instance_id); | ||
event_target.dispatchEvent(new SheepdogEvent('error')); | ||
if (instance) { | ||
instance.event_target.dispatchEvent(new SheepdogInstanceEvent('error')); | ||
instance.event_target.dispatchEvent(new SheepdogInstanceEvent('finish')); | ||
task_instance.lastErrored = instance.instance; | ||
@@ -50,2 +47,4 @@ instance.instance.error = error; | ||
update_is_running(); | ||
instance.event_target.dispatchEvent(new SheepdogInstanceEvent('error')); | ||
instance.event_target.dispatchEvent(new SheepdogInstanceEvent('finish')); | ||
// we delete after a microtask to avoid returnModifier | ||
@@ -58,11 +57,11 @@ // not founding the instance in case of a syncronous | ||
} | ||
event_target.dispatchEvent(new SheepdogEvent('error')); | ||
}, | ||
onInstanceCancel(instance_id) { | ||
const instance = instances.get(instance_id); | ||
event_target.dispatchEvent(new SheepdogEvent('cancel')); | ||
if (instance) { | ||
instance.is_running = false; | ||
update_is_running(); | ||
instance.event_target.dispatchEvent(new SheepdogInstanceEvent('cancel')); | ||
instance.event_target.dispatchEvent(new SheepdogInstanceEvent('finish')); | ||
instance.is_running = false; | ||
update_is_running(); | ||
// we delete after a microtask to avoid returnModifier | ||
@@ -75,2 +74,3 @@ // not founding the instance in case of a syncronous | ||
} | ||
event_target.dispatchEvent(new SheepdogEvent('cancel')); | ||
}, | ||
@@ -91,9 +91,8 @@ onInstanceCreate(instance_id) { | ||
}; | ||
event_target.dispatchEvent(new SheepdogEvent('instance-create')); | ||
task_instance.last = instance.instance; | ||
instances.set(instance_id, instance); | ||
event_target.dispatchEvent(new SheepdogEvent('instance-create')); | ||
}, | ||
onInstanceStart(instance_id) { | ||
const instance = instances.get(instance_id); | ||
event_target.dispatchEvent(new SheepdogEvent('instance-start')); | ||
if (instance) { | ||
@@ -105,6 +104,6 @@ instance.event_target.dispatchEvent(new SheepdogInstanceEvent('start')); | ||
task_instance.performCount++; | ||
event_target.dispatchEvent(new SheepdogEvent('instance-start')); | ||
}, | ||
onInstanceComplete(instance_id, last_result) { | ||
const instance = instances.get(instance_id); | ||
event_target.dispatchEvent(new SheepdogEvent('instance-complete')); | ||
if (instance) { | ||
@@ -123,2 +122,3 @@ instance.instance.value = last_result; | ||
} | ||
event_target.dispatchEvent(new SheepdogEvent('instance-complete')); | ||
}, | ||
@@ -125,0 +125,0 @@ returnModifier(instance_id, returned_value) { |
{ | ||
"name": "@sheepdog/vanilla", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |