Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Callback wrapping utility

License

NotificationsYou must be signed in to change notification settings

isaacs/wrappy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Callback wrapping utility

USAGE

varwrappy=require("wrappy")// var wrapper = wrappy(wrapperFunction)// make sure a cb is called only once// See also: http://npm.im/once for this specific use casevaronce=wrappy(function(cb){varcalled=falsereturnfunction(){if(called)returncalled=truereturncb.apply(this,arguments)}})functionprintBoo(){console.log('boo')}// has some rando propertyprintBoo.iAmBooPrinter=truevaronlyPrintOnce=once(printBoo)onlyPrintOnce()// prints 'boo'onlyPrintOnce()// does nothing// random property is retained!assert.equal(onlyPrintOnce.iAmBooPrinter,true)

About

Callback wrapping utility

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp