Skip to content

kinogam/kino.base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

kino.base - javascript base tools

How to use

use on a webpage

	<script type="text/javascript" src="kino.base.js"></script>

create a namespace

	kino.namespace("myspace.hello.world");

create object's property

	var obj = {myProp: "propval"};
    kino.createProp(obj, "newProp.subProp", "hello world");

extend from Class

	var MyClass = function () {
        this.name = 'Tom';
    };
    MyClass.prototype.hello = function () {
        return "hello " + this.name;
    }

    var obj = {name: 'James'};

    kino.extend(obj, MyClass);

    obj.hello(); //"hello James"

extend from obj

    var obj = {};
    var extendObj = {
        text: 'hello'
    };

    kino.extend(obj, extendObj);

    obj.text //'hello'

use observer model to trigger event

    var obj = {};
    kino.extend(obj, kino.Events);

    obj.on("test", function (obj) {
        //obj.name  "kino"
    });
    
    obj.on("test.a", function (obj) {
        //obj.name  "kino"
    });

    obj.trigger("test", { name: "kino" });
    
    obj.off("test.a");

About

kino.base

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published