Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

skilitics/tin-foil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tin Foil

Thin Tin Can wrapper for statement generation

Getting Started

Install the module with: npm install tin-foil

Usage

Define your verbs, objects and contexts by extending Verb, TinFoil and Context:

CoffeeScript

{ Activity } = require 'tin-foil'

class SceneActivity extends Activity
  @inherit()

  @identify_from (event) -> "http://skilitix.com/xapi/activities/scene/#{event.scene.id}"

  @definition_named 'en-US': 'Scene'
  @definition_typed_as 'http://skilitix.com/xapi/activities/node'
  @definition_description_from (event) -> 'en-US': event.scene.title

JavaScript

Activity = require('tin-foil').Activity;

var SceneActivity = Activity.extend()
    .identify_from(function (event) { return "http://skilitix.com/xapi/activities/scene/" + event.scene.id; })
    .definition_named({'en-US': 'Scene'})
    .definition_typed_as('http://skilitix.com/xapi/activities/node')
    .definition_description_from(function (event) { return {'en-US': event.scene.title}; });

Then define and compile your statements

SceneEnteredStatement = Statement.as 'user', i: 'entered', a: 'scene', in: 'scenario'
SceneEnteredStatement.compile(myEvent)

License

Copyright (c) 2013 Skilitix Licensed under the MIT license.

About

Thin wrapper for Tin Can statement generation

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors